diff options
Diffstat (limited to 'WebCore')
| -rw-r--r-- | WebCore/bindings/v8/ScheduledAction.cpp | 2 | ||||
| -rw-r--r-- | WebCore/bindings/v8/ScriptController.cpp | 3 | ||||
| -rw-r--r-- | WebCore/bindings/v8/V8AbstractEventListener.cpp | 1 | ||||
| -rw-r--r-- | WebCore/bindings/v8/V8Utilities.h | 5 | ||||
| -rw-r--r-- | WebCore/bindings/v8/V8WorkerContextEventListener.cpp | 2 | ||||
| -rw-r--r-- | WebCore/bindings/v8/WorkerContextExecutionProxy.cpp | 7 | ||||
| -rw-r--r-- | WebCore/config.h | 2 | 
7 files changed, 22 insertions, 0 deletions
| diff --git a/WebCore/bindings/v8/ScheduledAction.cpp b/WebCore/bindings/v8/ScheduledAction.cpp index ab51600..b1db8cf 100644 --- a/WebCore/bindings/v8/ScheduledAction.cpp +++ b/WebCore/bindings/v8/ScheduledAction.cpp @@ -105,6 +105,7 @@ void ScheduledAction::execute(V8Proxy* proxy)  {      ASSERT(proxy); +    LOCK_V8;      v8::HandleScope handleScope;      v8::Local<v8::Context> v8Context = proxy->GetContext();      if (v8Context.IsEmpty()) @@ -133,6 +134,7 @@ void ScheduledAction::execute(WorkerContext* workerContext)      WorkerScriptController* scriptController = workerContext->script();      if (!m_function.IsEmpty() && m_function->IsFunction()) { +        LOCK_V8;          v8::HandleScope handleScope;          v8::Local<v8::Context> v8Context = scriptController->proxy()->GetContext();          ASSERT(!v8Context.IsEmpty()); diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index 833c99f..97bb8ec 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -191,6 +191,7 @@ void ScriptController::evaluateInNewContext(const Vector<ScriptSourceCode>& sour  // Evaluate a script file in the environment of this proxy.  ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)  { +    LOCK_V8;      v8::HandleScope handleScope;      v8::Handle<v8::Context> context = V8Proxy::GetContext(m_proxy->frame());      if (context.IsEmpty()) @@ -225,6 +226,7 @@ void ScriptController::finishedWithEvent(Event* event)  // Create a V8 object with an interceptor of NPObjectPropertyGetter.  void ScriptController::bindToWindowObject(Frame* frame, const String& key, NPObject* object)  { +    LOCK_V8;      v8::HandleScope handleScope;      v8::Handle<v8::Context> context = V8Proxy::GetContext(frame); @@ -371,6 +373,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement      if (!isEnabled())          return createNoScriptObject(); +    LOCK_V8;      v8::HandleScope handleScope;      v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame);      if (context.IsEmpty()) diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp index 462a729..07e944d 100644 --- a/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -110,6 +110,7 @@ void V8AbstractEventListener::handleEvent(Event* event, bool isWindowEvent)      // See issue 889829.      RefPtr<V8AbstractEventListener> protect(this); +    LOCK_V8;      v8::HandleScope handleScope;      v8::Handle<v8::Context> context = V8Proxy::GetContext(m_frame); diff --git a/WebCore/bindings/v8/V8Utilities.h b/WebCore/bindings/v8/V8Utilities.h index 5769910..fdabc7a 100644 --- a/WebCore/bindings/v8/V8Utilities.h +++ b/WebCore/bindings/v8/V8Utilities.h @@ -33,6 +33,11 @@  // FIXME: Remove once chromium dependencies on v8_utility.h are removed.  #define V8UTILITIES_DEFINED 1 +#if ENABLE(V8_LOCKERS) +#define LOCK_V8 v8::Locker lock +#else +#define LOCK_V8 ((void) 0) +#endif  #include <v8.h> diff --git a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp index 9bb48fb..a21d3eb 100644 --- a/WebCore/bindings/v8/V8WorkerContextEventListener.cpp +++ b/WebCore/bindings/v8/V8WorkerContextEventListener.cpp @@ -35,6 +35,7 @@  #include "V8WorkerContextEventListener.h"  #include "Event.h" +#include "V8Utilities.h"  #include "WorkerContextExecutionProxy.h"  namespace WebCore { @@ -62,6 +63,7 @@ void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)      // See issue 889829.      RefPtr<V8AbstractEventListener> protect(this); +    LOCK_V8;      v8::HandleScope handleScope;      v8::Handle<v8::Context> context = m_proxy->GetContext(); diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index 7af9536..c87cdea 100644 --- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -141,6 +141,7 @@ void WorkerContextExecutionProxy::initV8IfNeeded()  {      static bool v8Initialized = false; +    LOCK_V8;      if (v8Initialized)          return; @@ -151,6 +152,10 @@ void WorkerContextExecutionProxy::initV8IfNeeded()      // Set up the handler for V8 error message.      v8::V8::AddMessageListener(handleConsoleMessage); +#if PLATFORM(ANDROID) +    const int workerThreadPreemptionIntervalMs = 5; +    v8::Locker::StartPreemption(workerThreadPreemptionIntervalMs); +#endif      v8Initialized = true;  } @@ -337,6 +342,7 @@ bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)  v8::Local<v8::Value> WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, int baseLine)  { +    LOCK_V8;      v8::HandleScope hs;      initContextIfNeeded(); @@ -394,6 +400,7 @@ PassRefPtr<V8EventListener> WorkerContextExecutionProxy::findOrCreateEventListen          newListener = V8WorkerContextObjectEventListener::create(this, v8::Local<v8::Object>::Cast(object), isInline);      else          newListener = V8WorkerContextEventListener::create(this, v8::Local<v8::Object>::Cast(object), isInline); +      m_listeners->add(newListener.get());      return newListener.release(); diff --git a/WebCore/config.h b/WebCore/config.h index 24a4e6a..c921d68 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -105,6 +105,8 @@  #define ENABLE_SVG 0  #undef ENABLE_WORKERS  #define ENABLE_WORKERS 1 +#undef ENABLE_V8_LOCKERS +#define ENABLE_V8_LOCKERS 1  #endif  #if ENABLE_SVG  #if !defined(ENABLE_SVG_ANIMATION) | 
