Title: [90407] trunk/Source/WebCore
Revision
90407
Author
h...@chromium.org
Date
2011-07-05 15:13:41 -0700 (Tue, 05 Jul 2011)

Log Message

2011-07-05  Hans Wennborg  <h...@chromium.org>

        [V8][Chromium] Remove use of OwnHandle from V8LocalContext
        https://bugs.webkit.org/show_bug.cgi?id=63925

        Reviewed by Adam Barth.

        Replace the OwnHandle<> member in V8LocalContext with
        v8::Persistent<v8::Context>.
        The code that used OwnHandle<> would not correctly Dispose
        of the Context, which would cause the memory to fill up when creating
        and destructing many V8LocalContext objects, such as in the case
        of IndexedDB.

        * bindings/v8/V8Utilities.cpp:
        (WebCore::V8LocalContext::V8LocalContext):
        (WebCore::V8LocalContext::~V8LocalContext):
        * bindings/v8/V8Utilities.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90406 => 90407)


--- trunk/Source/WebCore/ChangeLog	2011-07-05 21:29:42 UTC (rev 90406)
+++ trunk/Source/WebCore/ChangeLog	2011-07-05 22:13:41 UTC (rev 90407)
@@ -1,3 +1,22 @@
+2011-07-05  Hans Wennborg  <h...@chromium.org>
+
+        [V8][Chromium] Remove use of OwnHandle from V8LocalContext
+        https://bugs.webkit.org/show_bug.cgi?id=63925
+
+        Reviewed by Adam Barth.
+
+        Replace the OwnHandle<> member in V8LocalContext with
+        v8::Persistent<v8::Context>.
+        The code that used OwnHandle<> would not correctly Dispose
+        of the Context, which would cause the memory to fill up when creating
+        and destructing many V8LocalContext objects, such as in the case
+        of IndexedDB.
+
+        * bindings/v8/V8Utilities.cpp:
+        (WebCore::V8LocalContext::V8LocalContext):
+        (WebCore::V8LocalContext::~V8LocalContext):
+        * bindings/v8/V8Utilities.h:
+
 2011-07-05  Igor Oliveira  <igor.olive...@openbossa.org>
 
         [Qt] Add ShadowBlur support

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.cpp (90406 => 90407)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2011-07-05 21:29:42 UTC (rev 90406)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.cpp	2011-07-05 22:13:41 UTC (rev 90407)
@@ -49,16 +49,17 @@
 namespace WebCore {
 
 V8LocalContext::V8LocalContext()
+    : m_context(v8::Context::New())
 {
     V8BindingPerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
-    m_context.set(v8::Context::New());
-    m_context.get()->Enter();
+    m_context->Enter();
 }
 
 
-V8LocalContext::~V8LocalContext() 
+V8LocalContext::~V8LocalContext()
 {
-    m_context.get()->Exit();
+    m_context->Exit();
+    m_context.Dispose();
 }
 
 // Use an array to hold dependents. It works like a ref-counted scheme.

Modified: trunk/Source/WebCore/bindings/v8/V8Utilities.h (90406 => 90407)


--- trunk/Source/WebCore/bindings/v8/V8Utilities.h	2011-07-05 21:29:42 UTC (rev 90406)
+++ trunk/Source/WebCore/bindings/v8/V8Utilities.h	2011-07-05 22:13:41 UTC (rev 90407)
@@ -71,7 +71,7 @@
         virtual ~V8LocalContext();
     private:
         v8::HandleScope m_handleScope;
-        OwnHandle<v8::Context> m_context;
+        v8::Persistent<v8::Context> m_context;
     };
 
     // 'FunctionOnly' is assumed for the created callback.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to