diff options
Diffstat (limited to 'sca-cpp/trunk/modules')
-rwxr-xr-x | sca-cpp/trunk/modules/http/http-test | 1 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/http/httpd-test | 1 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/http/proxy-test | 2 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/js/eval.hpp | 21 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/server/httpd-test | 1 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/server/server-test | 1 | ||||
-rwxr-xr-x | sca-cpp/trunk/modules/server/wiring-test | 1 |
7 files changed, 24 insertions, 4 deletions
diff --git a/sca-cpp/trunk/modules/http/http-test b/sca-cpp/trunk/modules/http/http-test index e9ce572994..7874a1037f 100755 --- a/sca-cpp/trunk/modules/http/http-test +++ b/sca-cpp/trunk/modules/http/http-test @@ -19,6 +19,7 @@ # Setup ./httpd-conf tmp localhost 8090 htdocs +./httpd-event-conf tmp ./httpd-start tmp sleep 2 diff --git a/sca-cpp/trunk/modules/http/httpd-test b/sca-cpp/trunk/modules/http/httpd-test index 909bfa29f1..2b151d0e12 100755 --- a/sca-cpp/trunk/modules/http/httpd-test +++ b/sca-cpp/trunk/modules/http/httpd-test @@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix` # Setup ./httpd-conf tmp localhost 8090 htdocs +./httpd-event-conf tmp ./httpd-start tmp sleep 2 diff --git a/sca-cpp/trunk/modules/http/proxy-test b/sca-cpp/trunk/modules/http/proxy-test index d67d39aa1f..bf4e2bf460 100755 --- a/sca-cpp/trunk/modules/http/proxy-test +++ b/sca-cpp/trunk/modules/http/proxy-test @@ -19,8 +19,10 @@ # Setup ./httpd-conf tmp localhost 8091/8090 htdocs +./httpd-event-conf tmp ./httpd-start tmp ./httpd-conf tmp/proxy localhost 8090 tmp/proxy/htdocs +./httpd-event-conf tmp/proxy ./proxy-conf tmp/proxy ./proxy-member-conf tmp/proxy localhost 8091 ./httpd-start tmp/proxy diff --git a/sca-cpp/trunk/modules/js/eval.hpp b/sca-cpp/trunk/modules/js/eval.hpp index b36c9e6119..f18c3e41c9 100644 --- a/sca-cpp/trunk/modules/js/eval.hpp +++ b/sca-cpp/trunk/modules/js/eval.hpp @@ -103,14 +103,23 @@ JSClass jsGlobalClass = { "global", JSCLASS_GLOBAL_FLAGS, JSCLASS_NO_OPTIONAL_MEMBERS }; /** - * Represents a JavaScript context. Create one per thread. + * Represents a JavaScript context. Maintains one context per thread. */ +#ifdef WANT_THREADS +__thread +#endif +::JSContext* jsContext = NULL; + class JSContext { public: JSContext() { - // Create JS context + // Create JS context if necessary debug("js::jscontext"); - cx = JS_NewContext(jsRuntime, 8192); + if (jsContext != NULL) { + cx = jsContext; + return; + } + cx = JS_NewContext(jsRuntime, 32768); if(cx == NULL) return; JS_SetOptions(cx, JSOPTION_VAROBJFIX | JSOPTION_JIT | JSOPTION_METHODJIT); @@ -129,10 +138,13 @@ public: cleanup(); return; } + jsContext = cx; } ~JSContext() { debug("js::~jscontext"); + if (cx != NULL) + JS_GC(cx); cleanup(); } @@ -147,7 +159,8 @@ public: private: bool cleanup() { if(cx != NULL) { - JS_DestroyContext(cx); + if (cx != jsContext) + JS_DestroyContext(cx); cx = NULL; } return true; diff --git a/sca-cpp/trunk/modules/server/httpd-test b/sca-cpp/trunk/modules/server/httpd-test index c56f0e0981..d541c145e9 100755 --- a/sca-cpp/trunk/modules/server/httpd-test +++ b/sca-cpp/trunk/modules/server/httpd-test @@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix` # Setup ../http/httpd-conf tmp localhost 8090 htdocs +../http/httpd-event-conf tmp ./server-conf tmp ./scheme-conf tmp cat >>tmp/conf/httpd.conf <<EOF diff --git a/sca-cpp/trunk/modules/server/server-test b/sca-cpp/trunk/modules/server/server-test index 55e6f10926..43557e7f7b 100755 --- a/sca-cpp/trunk/modules/server/server-test +++ b/sca-cpp/trunk/modules/server/server-test @@ -19,6 +19,7 @@ # Setup ../http/httpd-conf tmp localhost 8090 htdocs +../http/httpd-event-conf tmp ./server-conf tmp ./scheme-conf tmp cat >>tmp/conf/httpd.conf <<EOF diff --git a/sca-cpp/trunk/modules/server/wiring-test b/sca-cpp/trunk/modules/server/wiring-test index 4278e5e30d..8bbcd684f2 100755 --- a/sca-cpp/trunk/modules/server/wiring-test +++ b/sca-cpp/trunk/modules/server/wiring-test @@ -23,6 +23,7 @@ curl_prefix=`cat $here/../http/curl.prefix` # Setup ../http/httpd-conf tmp localhost 8090 htdocs +../http/httpd-event-conf tmp ./server-conf tmp ./scheme-conf tmp cat >>tmp/conf/httpd.conf <<EOF |