Changeset 127976 in webkit


Ignore:
Timestamp:
Sep 8, 2012 11:48:14 PM (12 years ago)
Author:
abarth@webkit.org
Message:

[V8] unsafeHandleToCurrentWorldContext doesn't need to exist
https://bugs.webkit.org/show_bug.cgi?id=96191

Reviewed by Kentaro Hara.

Previously, we used this function when instantiating DOM wrappers. Now
we get the context from the creationContext, so we don't need access to
this unsafe handle. This patch inlines the function into its one other
caller.

  • bindings/v8/ScriptController.cpp:

(WebCore::ScriptController::currentWorldContext):

  • bindings/v8/ScriptController.h:

(ScriptController):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127974 r127976  
     12012-09-08  Adam Barth  <abarth@webkit.org>
     2
     3        [V8] unsafeHandleToCurrentWorldContext doesn't need to exist
     4        https://bugs.webkit.org/show_bug.cgi?id=96191
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Previously, we used this function when instantiating DOM wrappers. Now
     9        we get the context from the creationContext, so we don't need access to
     10        this unsafe handle. This patch inlines the function into its one other
     11        caller.
     12
     13        * bindings/v8/ScriptController.cpp:
     14        (WebCore::ScriptController::currentWorldContext):
     15        * bindings/v8/ScriptController.h:
     16        (ScriptController):
     17
    1182012-09-08  Benjamin Poulain  <bpoulain@apple.com>
    219
  • trunk/Source/WebCore/bindings/v8/ScriptController.cpp

    r127106 r127976  
    412412}
    413413
    414 v8::Persistent<v8::Context> ScriptController::unsafeHandleToCurrentWorldContext()
     414v8::Local<v8::Context> ScriptController::currentWorldContext()
    415415{
    416416    if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {
    417417        RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext();
    418418        if (m_frame != toFrameIfNotDetached(context->get()))
    419             return v8::Persistent<v8::Context>();
    420         return context->get();
     419            return v8::Local<v8::Context>();
     420        return v8::Local<v8::Context>::New(context->get());
    421421    }
    422422    windowShell()->initializeIfNeeded();
    423     return windowShell()->context();
    424 }
    425 
    426 v8::Local<v8::Context> ScriptController::currentWorldContext()
    427 {
    428     return v8::Local<v8::Context>::New(unsafeHandleToCurrentWorldContext());
     423    return v8::Local<v8::Context>::New(windowShell()->context());
    429424}
    430425
  • trunk/Source/WebCore/bindings/v8/ScriptController.h

    r127106 r127976  
    173173    v8::Local<v8::Context> currentWorldContext();
    174174
    175     // WARNING! The handle returned by this function might be Disposed() when JavaScript is executed.
    176     v8::Persistent<v8::Context> unsafeHandleToCurrentWorldContext();
    177 
    178175    // Pass command-line flags to the JS engine.
    179176    static void setFlags(const char* string, int length);
Note: See TracChangeset for help on using the changeset viewer.