summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-10-28 10:17:28 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-10-28 10:17:28 -0400
commit0ddb5835faa6cd39067b2a777ea9123a7f0a6ab1 (patch)
treebc0c56ca6f11780a44322b4af11bc3f12083c96a /WebCore/bindings
parent68f795feee72509a25c327be4f04835459439fa2 (diff)
parent3a209a6ece975c026508762103516b7d0e55c18a (diff)
downloadexternal_webkit-0ddb5835faa6cd39067b2a777ea9123a7f0a6ab1.zip
external_webkit-0ddb5835faa6cd39067b2a777ea9123a7f0a6ab1.tar.gz
external_webkit-0ddb5835faa6cd39067b2a777ea9123a7f0a6ab1.tar.bz2
Merge change Ia17a9f02 into eclair-mr2
* changes: Adds ScriptController::initializeThreading(), to allow initializeThreading() to be used with both JSC and V8 without the use of ifdefs.
Diffstat (limited to 'WebCore/bindings')
-rw-r--r--WebCore/bindings/js/ScriptController.cpp6
-rw-r--r--WebCore/bindings/js/ScriptController.h4
-rw-r--r--WebCore/bindings/v8/ScriptController.cpp9
-rw-r--r--WebCore/bindings/v8/ScriptController.h3
4 files changed, 22 insertions, 0 deletions
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 6de9b75..45f8c75 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -38,12 +38,18 @@
#include "npruntime_impl.h"
#include "runtime_root.h"
#include <debugger/Debugger.h>
+#include <runtime/InitializeThreading.h>
#include <runtime/JSLock.h>
using namespace JSC;
namespace WebCore {
+void ScriptController::initializeThreading()
+{
+ JSC::initializeThreading();
+}
+
ScriptController::ScriptController(Frame* frame)
: m_frame(frame)
, m_handlerLineNumber(0)
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 56e8f0c..9ae10fb 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -80,6 +80,10 @@ public:
return m_windowShell->window();
}
+ // This function must be called from the main thread. It is safe to call it repeatedly.
+ // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly.
+ static void initializeThreading();
+
ScriptValue evaluate(const ScriptSourceCode&);
void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&);
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index d2c1db2..85af072 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -60,6 +60,15 @@
namespace WebCore {
+void ScriptController::initializeThreading()
+{
+ static bool initializedThreading = false;
+ if (!initializedThreading) {
+ WTF::initializeThreading();
+ initializedThreading = true;
+ }
+}
+
void ScriptController::setFlags(const char* string, int length)
{
v8::V8::SetFlagsFromString(string, length);
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 9658b05..ec15103 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -59,6 +59,9 @@ namespace WebCore {
// or this accessor should be made JSProxy*
V8Proxy* proxy() { return m_proxy.get(); }
+ // This function must be called from the main thread. It is safe to call it repeatedly.
+ static void initializeThreading();
+
// Evaluate a script file in the environment of this proxy.
// If succeeded, 'succ' is set to true and result is returned
// as a string.