2009-05-26 Jian Li <jianli@chromium.org>
authorjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 May 2009 22:58:23 +0000 (22:58 +0000)
committerjianli@chromium.org <jianli@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 May 2009 22:58:23 +0000 (22:58 +0000)
        Reviewed by Dimitri Glazkov.

        https://bugs.webkit.org/show_bug.cgi?id=25944
        Remove the uses of V8 Locker in worker execution code. No additional test is needed.
        The normal WebKit layout tests should cover it. However, layout tests that start
        multiple workers will fail to pass due to test shell limitation in Chromium. To cover
        this, UI tests will be added (http://code.google.com/p/chromium/issues/detail?id=12554).

        * bindings/v8/V8WorkerContextEventListener.cpp:
        (WebCore::V8WorkerContextEventListener::handleEvent):
        * bindings/v8/WorkerContextExecutionProxy.cpp:
        (WebCore::WorkerContextExecutionProxy::dispose):
        (WebCore::WorkerContextExecutionProxy::initV8IfNeeded):
        (WebCore::WorkerContextExecutionProxy::evaluate):
        (WebCore::WorkerContextExecutionProxy::findOrCreateEventListenerHelper):
        (WebCore::WorkerContextExecutionProxy::RemoveEventListener):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@44162 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/v8/V8WorkerContextEventListener.cpp
WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

index e7045ed..22891fd 100644 (file)
@@ -1,3 +1,22 @@
+2009-05-26  Jian Li  <jianli@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25944
+        Remove the uses of V8 Locker in worker execution code. No additional test is needed.
+        The normal WebKit layout tests should cover it. However, layout tests that start
+        multiple workers will fail to pass due to test shell limitation in Chromium. To cover
+        this, UI tests will be added (http://code.google.com/p/chromium/issues/detail?id=12554).
+
+        * bindings/v8/V8WorkerContextEventListener.cpp:
+        (WebCore::V8WorkerContextEventListener::handleEvent):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::dispose):
+        (WebCore::WorkerContextExecutionProxy::initV8IfNeeded):
+        (WebCore::WorkerContextExecutionProxy::evaluate):
+        (WebCore::WorkerContextExecutionProxy::findOrCreateEventListenerHelper):
+        (WebCore::WorkerContextExecutionProxy::RemoveEventListener):
+
 2009-05-26  Dmitry Titov  <dimich@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index bc9bc40..9bb48fb 100644 (file)
@@ -62,7 +62,6 @@ void V8WorkerContextEventListener::handleEvent(Event* event, bool isWindowEvent)
     // See issue 889829.
     RefPtr<V8AbstractEventListener> protect(this);
 
-    v8::Locker locker;
     v8::HandleScope handleScope;
 
     v8::Handle<v8::Context> context = m_proxy->GetContext();
index 5bb1e1e..5947a1e 100644 (file)
@@ -107,11 +107,7 @@ void WorkerContextExecutionProxy::dispose()
         for (V8EventListenerList::iterator iterator(m_listeners->begin()); iterator != m_listeners->end(); ++iterator)
            static_cast<V8WorkerContextEventListener*>(*iterator)->disconnect();
 
-        {
-            // Need to use lock since V8EventListenerList::clear() creates HandleScope.
-            v8::Locker locker;
-            m_listeners->clear();
-        }
+        m_listeners->clear();
     }
 
     // Detach all events from their JS wrappers.
@@ -145,8 +141,6 @@ void WorkerContextExecutionProxy::initV8IfNeeded()
 {
     static bool v8Initialized = false;
 
-    // Use v8::Locker to guarantee that only one thread can enter the following one-time initialization code.
-    v8::Locker locker;
     if (v8Initialized)
         return;
 
@@ -157,10 +151,6 @@ void WorkerContextExecutionProxy::initV8IfNeeded()
     // Set up the handler for V8 error message.
     v8::V8::AddMessageListener(handleConsoleMessage);
 
-    // Enable preemption so that one worker will not be blocked by another long-running worker.
-    const int workerThreadPreemptionIntervalMs = 100;
-    v8::Locker::StartPreemption(workerThreadPreemptionIntervalMs);
-
     v8Initialized = true;
 }
 
@@ -347,7 +337,6 @@ bool WorkerContextExecutionProxy::forgetV8EventObject(Event* event)
 
 v8::Local<v8::Value> WorkerContextExecutionProxy::evaluate(const String& script, const String& fileName, int baseLine)
 {
-    v8::Locker locker;
     v8::HandleScope hs;
 
     initContextIfNeeded();
@@ -405,11 +394,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);
-    {
-        // Need to use lock since V8EventListenerList::add() creates HandleScope.
-        v8::Locker locker;
-        m_listeners->add(newListener.get());
-    }
+    m_listeners->add(newListener.get());
 
     return newListener.release();
 }
@@ -426,8 +411,6 @@ PassRefPtr<V8EventListener> WorkerContextExecutionProxy::findOrCreateObjectEvent
 
 void WorkerContextExecutionProxy::RemoveEventListener(V8EventListener* listener)
 {
-    // Need to use lock since V8EventListenerList::remove() creates HandleScope.
-    v8::Locker locker;
     m_listeners->remove(listener);
 }