Changeset 126137 in webkit


Ignore:
Timestamp:
Aug 20, 2012 11:50:42 PM (12 years ago)
Author:
haraken@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126136 r126137  
     12012-08-20  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Move handleOutOfMemory() from V8Proxy to V8Binding
     4        https://bugs.webkit.org/show_bug.cgi?id=94563
     5
     6        Reviewed by Adam Barth.
     7
     8        To kill V8Proxy, this patch moves handleOutOfMemory() from V8Proxy to V8Binding.
     9
     10        No tests. No change in behavior.
     11
     12        * bindings/v8/V8AbstractEventListener.cpp:
     13        (WebCore::V8AbstractEventListener::invokeEventHandler):
     14        * bindings/v8/V8Binding.cpp:
     15        (WebCore::handleOutOfMemory):
     16        (WebCore):
     17        * bindings/v8/V8Binding.h:
     18        (WebCore):
     19        * bindings/v8/V8Proxy.cpp:
     20        * bindings/v8/V8Proxy.h:
     21        (V8Proxy):
     22        * bindings/v8/WorkerContextExecutionProxy.cpp:
     23        (WebCore::WorkerContextExecutionProxy::runScript):
     24
    1252012-08-20  MORITA Hajime  <morrita@google.com>
    226
  • trunk/Source/WebCore/bindings/v8/V8AbstractEventListener.cpp

    r110222 r126137  
    182182        DateExtension::get()->setAllowSleep(true);
    183183
    184     ASSERT(!V8Proxy::handleOutOfMemory() || returnValue.IsEmpty());
     184    ASSERT(!handleOutOfMemory() || returnValue.IsEmpty());
    185185
    186186    if (returnValue.IsEmpty())
  • trunk/Source/WebCore/bindings/v8/V8Binding.cpp

    r126103 r126137  
    3939#include "PlatformString.h"
    4040#include "QualifiedName.h"
     41#include "Settings.h"
    4142#include "V8DOMStringList.h"
    4243#include "V8DOMWindow.h"
     
    411412}
    412413
     414bool handleOutOfMemory()
     415{
     416    v8::Local<v8::Context> context = v8::Context::GetCurrent();
     417
     418    if (!context->HasOutOfMemoryException())
     419        return false;
     420
     421    // Warning, error, disable JS for this frame?
     422    Frame* frame = toFrameIfNotDetached(context);
     423    if (!frame)
     424        return true;
     425
     426    frame->script()->clearForClose();
     427    frame->script()->windowShell()->destroyGlobal();
     428
     429#if PLATFORM(CHROMIUM)
     430    PlatformSupport::notifyJSOutOfMemory(frame);
     431#endif
     432
     433    if (Settings* settings = frame->settings())
     434        settings->setScriptEnabled(false);
     435
     436    return true;
     437}
     438
    413439void crashIfV8IsDead()
    414440{
  • trunk/Source/WebCore/bindings/v8/V8Binding.h

    r126103 r126137  
    379379    V8PerContextData* perContextDataForCurrentWorld(Frame*);
    380380
     381    // If the current context causes out of memory, JavaScript setting
     382    // is disabled and it returns true.
     383    bool handleOutOfMemory();
     384
    381385    void crashIfV8IsDead();
    382386
  • trunk/Source/WebCore/bindings/v8/V8Proxy.cpp

    r126109 r126137  
    133133}
    134134
    135 bool V8Proxy::handleOutOfMemory()
    136 {
    137     v8::Local<v8::Context> context = v8::Context::GetCurrent();
    138 
    139     if (!context->HasOutOfMemoryException())
    140         return false;
    141 
    142     // Warning, error, disable JS for this frame?
    143     Frame* frame = toFrameIfNotDetached(context);
    144     if (!frame)
    145         return true;
    146 
    147     frame->script()->clearForClose();
    148     frame->script()->windowShell()->destroyGlobal();
    149 
    150 #if PLATFORM(CHROMIUM)
    151     PlatformSupport::notifyJSOutOfMemory(frame);
    152 #endif
    153 
    154     if (Settings* settings = frame->settings())
    155         settings->setScriptEnabled(false);
    156 
    157     return true;
    158 }
    159 
    160135PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript)
    161136{
  • trunk/Source/WebCore/bindings/v8/V8Proxy.h

    r126109 r126137  
    105105        static v8::Local<v8::Context> context(Frame*);
    106106
    107         // If the current context causes out of memory, JavaScript setting
    108         // is disabled and it returns true.
    109         static bool handleOutOfMemory();
    110 
    111107        static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, const TextPosition& scriptStartPosition, v8::ScriptData* = 0);
    112108
  • trunk/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp

    r125995 r126137  
    254254    }
    255255
    256     if (V8Proxy::handleOutOfMemory())
     256    if (handleOutOfMemory())
    257257        ASSERT(script.IsEmpty());
    258258
Note: See TracChangeset for help on using the changeset viewer.