Changeset 61466 in webkit


Ignore:
Timestamp:
Jun 18, 2010 11:54:24 PM (14 years ago)
Author:
aa@chromium.org
Message:

2010-06-18 Aaron Boodman <aa@chromium.org>

WebKit API: Undo static hooks into V8 when WebKit is shut down.
https://bugs.webkit.org/show_bug.cgi?id=40816

  • bindings/v8/V8DOMWindowShell.cpp: (WebCore::V8DOMWindowShell::initContextIfNeeded): (WebCore::V8DOMWindowShell::initializeV8IfNeeded): (WebCore::V8DOMWindowShell::uninitializeV8IfNeeded):
  • bindings/v8/V8DOMWindowShell.h:

2010-06-18 Aaron Boodman <aa@chromium.org>

WebKit API: Undo static hooks into V8 when WebKit is shut downm
https://bugs.webkit.org/show_bug.cgi?id=40816

  • src/WebKit.cpp: (WebKit::shutdown): Call new WebCore::V8DOMWindowShell::uninitializeV8IfNeeded().
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r61463 r61466  
     12010-06-18  Aaron Boodman  <aa@chromium.org>
     2
     3        WebKit API: Undo static hooks into V8 when WebKit is shut down.
     4        https://bugs.webkit.org/show_bug.cgi?id=40816
     5
     6        * bindings/v8/V8DOMWindowShell.cpp:
     7        (WebCore::V8DOMWindowShell::initContextIfNeeded):
     8        (WebCore::V8DOMWindowShell::initializeV8IfNeeded):
     9        (WebCore::V8DOMWindowShell::uninitializeV8IfNeeded):
     10        * bindings/v8/V8DOMWindowShell.h:
     11
    1122010-06-18  Jessie Berlin  <jberlin@webkit.org>
    213
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r60670 r61466  
    117117        V8Proxy::reportUnsafeAccessTo(target, V8Proxy::ReportLater);
    118118}
     119
     120bool V8DOMWindowShell::s_isV8Initialized = false;
    119121
    120122PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame)
     
    248250    v8::HandleScope handleScope;
    249251
    250     // Setup the security handlers and message listener. This only has
    251     // to be done once.
    252     static bool isV8Initialized = false;
    253     if (!isV8Initialized) {
    254         // Tells V8 not to call the default OOM handler, binding code
    255         // will handle it.
    256         v8::V8::IgnoreOutOfMemoryException();
    257         v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
    258 
    259         v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
    260         v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
    261 
    262         v8::V8::AddMessageListener(&V8ConsoleMessage::handler);
    263 
    264         v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
    265 
    266         isV8Initialized = true;
    267     }
    268 
     252    initializeV8IfNeeded();
    269253
    270254    m_context = createNewContext(m_global, 0);
     
    309293}
    310294
     295void V8DOMWindowShell::initializeV8IfNeeded()
     296{
     297    if (s_isV8Initialized)
     298      return;
     299
     300    // Tells V8 not to call the default OOM handler, binding code
     301    // will handle it.
     302    v8::V8::IgnoreOutOfMemoryException();
     303    v8::V8::SetFatalErrorHandler(reportFatalErrorInV8);
     304
     305    v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue);
     306    v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue);
     307
     308    v8::V8::AddMessageListener(&V8ConsoleMessage::handler);
     309
     310    v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess);
     311
     312    s_isV8Initialized = true;
     313}
     314
     315void V8DOMWindowShell::uninitializeV8IfNeeded()
     316{
     317    if (!s_isV8Initialized)
     318      return;
     319
     320    v8::V8::SetFatalErrorHandler(0);
     321    v8::V8::SetGlobalGCPrologueCallback(0);
     322    v8::V8::SetGlobalGCEpilogueCallback(0);
     323    v8::V8::SetFailedAccessCheckCallbackFunction(0);
     324    v8::V8::RemoveMessageListeners(&V8ConsoleMessage::handler);
     325
     326    // FIXME: This one cannot be undone yet.
     327    // v8::V8::IgnoreOutOfMemoryException();
     328
     329    s_isV8Initialized = false;
     330}
     331
    311332v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Object> global, int extensionGroup)
    312333{
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.h

    r60670 r61466  
    5151public:
    5252    static PassRefPtr<V8DOMWindowShell> create(Frame*);
     53    static void initializeV8IfNeeded();
     54    static void uninitializeV8IfNeeded();
    5355
    5456    v8::Handle<v8::Context> context() const { return m_context; }
     
    120122    v8::Persistent<v8::Object> m_global;
    121123    v8::Persistent<v8::Object> m_document;
     124
     125    static bool s_isV8Initialized;
    122126};
    123127
  • trunk/WebKit/chromium/ChangeLog

    r61458 r61466  
     12010-06-18  Aaron Boodman  <aa@chromium.org>
     2
     3        WebKit API: Undo static hooks into V8 when WebKit is shut downm
     4        https://bugs.webkit.org/show_bug.cgi?id=40816
     5
     6        * src/WebKit.cpp:
     7        (WebKit::shutdown): Call new WebCore::V8DOMWindowShell::uninitializeV8IfNeeded().
     8
    192010-06-18  Drew Wilson  <atwilson@chromium.org>
    210
  • trunk/WebKit/chromium/src/WebKit.cpp

    r58266 r61466  
    4242#include "WorkerContextExecutionProxy.h"
    4343
     44#if USE(V8)
     45#include "V8DOMWindowShell.h"
     46#endif
     47
    4448#include <wtf/Assertions.h>
    4549#include <wtf/Threading.h>
     
    7983void shutdown()
    8084{
     85#if USE(V8)
     86    WebCore::V8DOMWindowShell::uninitializeV8IfNeeded();
     87#endif
    8188    s_webKitClient = 0;
    8289}
Note: See TracChangeset for help on using the changeset viewer.