Title: [132574] trunk/Source/WebCore
Revision
132574
Author
[email protected]
Date
2012-10-25 23:39:49 -0700 (Thu, 25 Oct 2012)

Log Message

[V8] WorkerContextExecutionProxy should use ScopedPersistent
https://bugs.webkit.org/show_bug.cgi?id=100443

Reviewed by Eric Seidel.

This class was manually re-implementing the ScopedPersistent pattern.

* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::dispose):
(WebCore::WorkerContextExecutionProxy::initializeIfNeeded):
(WebCore::WorkerContextExecutionProxy::evaluate):
* bindings/v8/WorkerContextExecutionProxy.h:
(WebCore::WorkerContextExecutionProxy::context):
(WorkerContextExecutionProxy):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132573 => 132574)


--- trunk/Source/WebCore/ChangeLog	2012-10-26 05:41:30 UTC (rev 132573)
+++ trunk/Source/WebCore/ChangeLog	2012-10-26 06:39:49 UTC (rev 132574)
@@ -1,3 +1,20 @@
+2012-10-25  Adam Barth  <[email protected]>
+
+        [V8] WorkerContextExecutionProxy should use ScopedPersistent
+        https://bugs.webkit.org/show_bug.cgi?id=100443
+
+        Reviewed by Eric Seidel.
+
+        This class was manually re-implementing the ScopedPersistent pattern.
+
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::dispose):
+        (WebCore::WorkerContextExecutionProxy::initializeIfNeeded):
+        (WebCore::WorkerContextExecutionProxy::evaluate):
+        * bindings/v8/WorkerContextExecutionProxy.h:
+        (WebCore::WorkerContextExecutionProxy::context):
+        (WorkerContextExecutionProxy):
+
 2012-10-25  Peter Wang  <[email protected]>
 
         A mistake in WebCore::_javascript_CallFrame::evaluate which will cause assert failed

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp (132573 => 132574)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-10-26 05:41:30 UTC (rev 132573)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-10-26 06:39:49 UTC (rev 132574)
@@ -100,12 +100,7 @@
 void WorkerContextExecutionProxy::dispose()
 {
     m_perContextData.clear();
-
-    // Dispose the context.
-    if (!m_context.IsEmpty()) {
-        m_context.Dispose();
-        m_context.Clear();
-    }
+    m_context.clear();
 }
 
 void WorkerContextExecutionProxy::initIsolate()
@@ -132,7 +127,7 @@
 bool WorkerContextExecutionProxy::initializeIfNeeded()
 {
     // Bail out if the context has already been initialized.
-    if (!m_context.IsEmpty())
+    if (!m_context.isEmpty())
         return true;
 
     // Setup the security handlers and message listener. This only has
@@ -143,16 +138,16 @@
 
     // Create a new environment
     v8::Persistent<v8::ObjectTemplate> globalTemplate;
-    m_context = v8::Context::New(0, globalTemplate);
-    if (m_context.IsEmpty())
+    m_context.adopt(v8::Context::New(0, globalTemplate));
+    if (m_context.isEmpty())
         return false;
 
     // Starting from now, use local context only.
-    v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context);
+    v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_context.get());
 
     v8::Context::Scope scope(context);
 
-    m_perContextData = V8PerContextData::create(m_context);
+    m_perContextData = V8PerContextData::create(m_context.get());
     if (!m_perContextData->init()) {
         dispose();
         return false;
@@ -202,7 +197,7 @@
         m_disableEvalPending = String();
     }
 
-    v8::Context::Scope scope(m_context);
+    v8::Context::Scope scope(m_context.get());
 
     v8::TryCatch exceptionCatcher;
 

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h (132573 => 132574)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h	2012-10-26 05:41:30 UTC (rev 132573)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.h	2012-10-26 06:39:49 UTC (rev 132574)
@@ -74,7 +74,7 @@
         ScriptValue evaluate(const String& script, const String& fileName, const TextPosition& scriptStartPosition, WorkerContextExecutionState*);
 
         // Returns a local handle of the context.
-        v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context); }
+        v8::Local<v8::Context> context() { return v8::Local<v8::Context>::New(m_context.get()); }
 
     private:
         void initIsolate();
@@ -84,7 +84,7 @@
         static const int kWorkerMaxStackSize = 500 * 1024;
 
         WorkerContext* m_workerContext;
-        v8::Persistent<v8::Context> m_context;
+        ScopedPersistent<v8::Context> m_context;
         OwnPtr<V8PerContextData> m_perContextData;
         String m_disableEvalPending;
     };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to