Title: [126137] trunk/Source/WebCore
Revision
126137
Author
[email protected]
Date
2012-08-20 23:50:42 -0700 (Mon, 20 Aug 2012)

Log Message

[V8] Move handleOutOfMemory() from V8Proxy to V8Binding
https://bugs.webkit.org/show_bug.cgi?id=94563

Reviewed by Adam Barth.

To kill V8Proxy, this patch moves handleOutOfMemory() from V8Proxy to V8Binding.

No tests. No change in behavior.

* bindings/v8/V8AbstractEventListener.cpp:
(WebCore::V8AbstractEventListener::invokeEventHandler):
* bindings/v8/V8Binding.cpp:
(WebCore::handleOutOfMemory):
(WebCore):
* bindings/v8/V8Binding.h:
(WebCore):
* bindings/v8/V8Proxy.cpp:
* bindings/v8/V8Proxy.h:
(V8Proxy):
* bindings/v8/WorkerContextExecutionProxy.cpp:
(WebCore::WorkerContextExecutionProxy::runScript):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126136 => 126137)


--- trunk/Source/WebCore/ChangeLog	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/ChangeLog	2012-08-21 06:50:42 UTC (rev 126137)
@@ -1,3 +1,27 @@
+2012-08-20  Kentaro Hara  <[email protected]>
+
+        [V8] Move handleOutOfMemory() from V8Proxy to V8Binding
+        https://bugs.webkit.org/show_bug.cgi?id=94563
+
+        Reviewed by Adam Barth.
+
+        To kill V8Proxy, this patch moves handleOutOfMemory() from V8Proxy to V8Binding.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8AbstractEventListener.cpp:
+        (WebCore::V8AbstractEventListener::invokeEventHandler):
+        * bindings/v8/V8Binding.cpp:
+        (WebCore::handleOutOfMemory):
+        (WebCore):
+        * bindings/v8/V8Binding.h:
+        (WebCore):
+        * bindings/v8/V8Proxy.cpp:
+        * bindings/v8/V8Proxy.h:
+        (V8Proxy):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::runScript):
+
 2012-08-20  MORITA Hajime  <[email protected]>
 
         InsertionShouldCallDidNotifyDescendantInsertions should be merged to InsertionShouldCallDidNotifySubtreeInsertions

Modified: trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp	2012-08-21 06:50:42 UTC (rev 126137)
@@ -181,7 +181,7 @@
     if (event->type() == eventNames().beforeunloadEvent || event->type() == eventNames().unloadEvent)
         DateExtension::get()->setAllowSleep(true);
 
-    ASSERT(!V8Proxy::handleOutOfMemory() || returnValue.IsEmpty());
+    ASSERT(!handleOutOfMemory() || returnValue.IsEmpty());
 
     if (returnValue.IsEmpty())
         return;

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp	2012-08-21 06:50:42 UTC (rev 126137)
@@ -38,6 +38,7 @@
 #include "MemoryInstrumentation.h"
 #include "PlatformString.h"
 #include "QualifiedName.h"
+#include "Settings.h"
 #include "V8DOMStringList.h"
 #include "V8DOMWindow.h"
 #include "V8Element.h"
@@ -410,6 +411,31 @@
     return frame->script()->windowShell()->perContextData();
 }
 
+bool handleOutOfMemory()
+{
+    v8::Local<v8::Context> context = v8::Context::GetCurrent();
+
+    if (!context->HasOutOfMemoryException())
+        return false;
+
+    // Warning, error, disable JS for this frame?
+    Frame* frame = toFrameIfNotDetached(context);
+    if (!frame)
+        return true;
+
+    frame->script()->clearForClose();
+    frame->script()->windowShell()->destroyGlobal();
+
+#if PLATFORM(CHROMIUM)
+    PlatformSupport::notifyJSOutOfMemory(frame);
+#endif
+
+    if (Settings* settings = frame->settings())
+        settings->setScriptEnabled(false);
+
+    return true;
+}
+
 void crashIfV8IsDead()
 {
     if (v8::V8::IsDead()) {

Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h	2012-08-21 06:50:42 UTC (rev 126137)
@@ -378,6 +378,10 @@
     // Returns the PerContextData associated with a frame for the current isolated world.
     V8PerContextData* perContextDataForCurrentWorld(Frame*);
 
+    // If the current context causes out of memory, _javascript_ setting
+    // is disabled and it returns true.
+    bool handleOutOfMemory();
+
     void crashIfV8IsDead();
 
     class V8ParameterBase {

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2012-08-21 06:50:42 UTC (rev 126137)
@@ -132,31 +132,6 @@
     return script;
 }
 
-bool V8Proxy::handleOutOfMemory()
-{
-    v8::Local<v8::Context> context = v8::Context::GetCurrent();
-
-    if (!context->HasOutOfMemoryException())
-        return false;
-
-    // Warning, error, disable JS for this frame?
-    Frame* frame = toFrameIfNotDetached(context);
-    if (!frame)
-        return true;
-
-    frame->script()->clearForClose();
-    frame->script()->windowShell()->destroyGlobal();
-
-#if PLATFORM(CHROMIUM)
-    PlatformSupport::notifyJSOutOfMemory(frame);
-#endif
-
-    if (Settings* settings = frame->settings())
-        settings->setScriptEnabled(false);
-
-    return true;
-}
-
 PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript)
 {
     // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2012-08-21 06:50:42 UTC (rev 126137)
@@ -104,10 +104,6 @@
         // a new context. It is potentially slow and consumes memory.
         static v8::Local<v8::Context> context(Frame*);
 
-        // If the current context causes out of memory, _javascript_ setting
-        // is disabled and it returns true.
-        static bool handleOutOfMemory();
-
         static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* = 0);
 
         v8::Local<v8::Context> context();

Modified: trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp (126136 => 126137)


--- trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-08-21 06:49:27 UTC (rev 126136)
+++ trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp	2012-08-21 06:50:42 UTC (rev 126137)
@@ -253,7 +253,7 @@
         script = V8Proxy::compileScript(code, "", TextPosition::minimumPosition());
     }
 
-    if (V8Proxy::handleOutOfMemory())
+    if (handleOutOfMemory())
         ASSERT(script.IsEmpty());
 
     if (script.IsEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to