summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-23 12:43:55 +0100
committerSteve Block <steveblock@google.com>2009-10-27 11:12:06 +0000
commit3a209a6ece975c026508762103516b7d0e55c18a (patch)
treeac5d37ae7266755cf0462ac1ff54d50ef9e8daaa /WebCore/bindings
parent1e13e466217c7ffb96f5cde0ad0ab8606c0c2481 (diff)
downloadexternal_webkit-3a209a6ece975c026508762103516b7d0e55c18a.zip
external_webkit-3a209a6ece975c026508762103516b7d0e55c18a.tar.gz
external_webkit-3a209a6ece975c026508762103516b7d0e55c18a.tar.bz2
Adds ScriptController::initializeThreading(), to allow initializeThreading() to be used with both JSC and V8 without the use of ifdefs.
See https://bugs.webkit.org/show_bug.cgi?id=30678 This has now been upstreamed to webkit.org, so submitting to Android to avoid future merge conflicts. Change-Id: Ia17a9f02060f04b11a8bffa367164162775516ba
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.