Changeset 139610 in webkit


Ignore:
Timestamp:
Jan 14, 2013 5:08:17 AM (11 years ago)
Author:
haraken@chromium.org
Message:

[V8] Add m_isolate to ScriptController, WorkerScriptController and V8DOMWindowShell
https://bugs.webkit.org/show_bug.cgi?id=106771

Reviewed by Adam Barth.

This is one of the steps to pass an Isolate everywhere.

No tests. No change in behavior.

  • bindings/v8/ScriptController.cpp:

(WebCore::ScriptController::ScriptController):
(WebCore::ScriptController::windowShell):

  • bindings/v8/ScriptController.h:

(ScriptController):

  • bindings/v8/V8DOMWindowShell.cpp:

(WebCore::V8DOMWindowShell::create):
(WebCore::V8DOMWindowShell::V8DOMWindowShell):
(WebCore::V8DOMWindowShell::initializeIfNeeded):
(WebCore::V8DOMWindowShell::installDOMWindow):

  • bindings/v8/V8DOMWindowShell.h:

(V8DOMWindowShell):

  • bindings/v8/V8Initializer.cpp:

(WebCore::V8Initializer::initializeMainThreadIfNeeded):
(WebCore::V8Initializer::initializeWorker):

  • bindings/v8/V8Initializer.h:

(V8Initializer):

  • bindings/v8/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::WorkerScriptController):
(WebCore::WorkerScriptController::initializeContextIfNeeded):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r139607 r139610  
     12013-01-14  Kentaro Hara  <haraken@chromium.org>
     2
     3        [V8] Add m_isolate to ScriptController, WorkerScriptController and V8DOMWindowShell
     4        https://bugs.webkit.org/show_bug.cgi?id=106771
     5
     6        Reviewed by Adam Barth.
     7
     8        This is one of the steps to pass an Isolate everywhere.
     9
     10        No tests. No change in behavior.
     11
     12        * bindings/v8/ScriptController.cpp:
     13        (WebCore::ScriptController::ScriptController):
     14        (WebCore::ScriptController::windowShell):
     15        * bindings/v8/ScriptController.h:
     16        (ScriptController):
     17        * bindings/v8/V8DOMWindowShell.cpp:
     18        (WebCore::V8DOMWindowShell::create):
     19        (WebCore::V8DOMWindowShell::V8DOMWindowShell):
     20        (WebCore::V8DOMWindowShell::initializeIfNeeded):
     21        (WebCore::V8DOMWindowShell::installDOMWindow):
     22        * bindings/v8/V8DOMWindowShell.h:
     23        (V8DOMWindowShell):
     24        * bindings/v8/V8Initializer.cpp:
     25        (WebCore::V8Initializer::initializeMainThreadIfNeeded):
     26        (WebCore::V8Initializer::initializeWorker):
     27        * bindings/v8/V8Initializer.h:
     28        (V8Initializer):
     29        * bindings/v8/WorkerScriptController.cpp:
     30        (WebCore::WorkerScriptController::WorkerScriptController):
     31        (WebCore::WorkerScriptController::initializeContextIfNeeded):
     32
    1332013-01-14  Alexander Pavlov  <apavlov@chromium.org>
    234
  • trunk/Source/WebCore/bindings/v8/ScriptController.cpp

    r136822 r139610  
    103103    : m_frame(frame)
    104104    , m_sourceURL(0)
    105     , m_windowShell(V8DOMWindowShell::create(frame, mainThreadNormalWorld()))
     105    , m_isolate(v8::Isolate::GetCurrent())
     106    , m_windowShell(V8DOMWindowShell::create(frame, mainThreadNormalWorld(), m_isolate))
    106107    , m_paused(false)
    107108#if ENABLE(NETSCAPE_PLUGIN_API)
     
    358359            shell = iter->value.get();
    359360        else {
    360             OwnPtr<V8DOMWindowShell> isolatedWorldShell = V8DOMWindowShell::create(m_frame, world);
     361            OwnPtr<V8DOMWindowShell> isolatedWorldShell = V8DOMWindowShell::create(m_frame, world, m_isolate);
    361362            shell = isolatedWorldShell.get();
    362363            m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release());
  • trunk/Source/WebCore/bindings/v8/ScriptController.h

    r135687 r139610  
    200200    Frame* m_frame;
    201201    const String* m_sourceURL;
     202    v8::Isolate* m_isolate;
    202203
    203204    OwnPtr<V8DOMWindowShell> m_windowShell;
  • trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r136822 r139610  
    8282}
    8383
    84 PassOwnPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame, PassRefPtr<DOMWrapperWorld> world)
    85 {
    86     return adoptPtr(new V8DOMWindowShell(frame, world));
    87 }
    88 
    89 V8DOMWindowShell::V8DOMWindowShell(Frame* frame, PassRefPtr<DOMWrapperWorld> world)
     84PassOwnPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Isolate* isolate)
     85{
     86    return adoptPtr(new V8DOMWindowShell(frame, world, isolate));
     87}
     88
     89V8DOMWindowShell::V8DOMWindowShell(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Isolate* isolate)
    9090    : m_frame(frame)
    9191    , m_world(world)
     92    , m_isolate(isolate)
    9293{
    9394}
     
    202203    v8::HandleScope handleScope;
    203204
    204     V8Initializer::initializeMainThreadIfNeeded();
     205    V8Initializer::initializeMainThreadIfNeeded(m_isolate);
    205206
    206207    createContext();
     
    335336    V8DOMWrapper::setNativeInfo(innerGlobalObject, &V8DOMWindow::info, window);
    336337    innerGlobalObject->SetPrototype(windowWrapper);
    337     V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper);
     338    V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper, m_isolate);
    338339    return true;
    339340}
  • trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h

    r135687 r139610  
    5454class V8DOMWindowShell {
    5555public:
    56     static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorld>);
     56    static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
    5757
    5858    v8::Persistent<v8::Context> context() const { return m_context.get(); }
     
    8282
    8383private:
    84     V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>);
     84    V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
    8585
    8686    void disposeContext();
     
    102102    Frame* m_frame;
    103103    RefPtr<DOMWrapperWorld> m_world;
     104    v8::Isolate* m_isolate;
    104105
    105106    OwnPtr<V8PerContextData> m_perContextData;
  • trunk/Source/WebCore/bindings/v8/V8Initializer.cpp

    r136605 r139610  
    4141#include "V8Location.h"
    4242#include "V8PerContextData.h"
    43 #include <v8.h>
    4443#include <wtf/RefPtr.h>
    4544#include <wtf/text/WTFString.h>
     
    105104}
    106105
    107 void V8Initializer::initializeMainThreadIfNeeded()
     106void V8Initializer::initializeMainThreadIfNeeded(v8::Isolate* isolate)
    108107{
    109108    ASSERT(isMainThread());
     
    123122    ScriptProfiler::initialize();
    124123#endif
    125     V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
     124    V8PerIsolateData::ensureInitialized(isolate);
    126125
    127126    // FIXME: Remove the following 2 lines when V8 default has changed.
     
    158157static const int kWorkerMaxStackSize = 500 * 1024;
    159158
    160 void V8Initializer::initializeWorker()
     159void V8Initializer::initializeWorker(v8::Isolate* isolate)
    161160{
    162161    v8::V8::AddMessageListener(messageHandlerInWorker);
     
    176175    v8::SetResourceConstraints(&resourceConstraints);
    177176
    178     V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
     177    V8PerIsolateData::ensureInitialized(isolate);
    179178}
    180179
  • trunk/Source/WebCore/bindings/v8/V8Initializer.h

    r135674 r139610  
    2727#define V8Initializer_h
    2828
     29#include <v8.h>
     30
    2931namespace WebCore {
    3032
    3133class V8Initializer {
    3234public:
    33     static void initializeMainThreadIfNeeded();
    34     static void initializeWorker();
     35    static void initializeMainThreadIfNeeded(v8::Isolate*);
     36    static void initializeWorker(v8::Isolate*);
    3537};
    3638   
  • trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp

    r136822 r139610  
    6767    data->setDOMDataStore(m_domDataStore.get());
    6868
    69     V8Initializer::initializeWorker();
     69    V8Initializer::initializeWorker(m_isolate);
    7070}
    7171
     
    128128    }
    129129
    130     V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext);
     130    V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext, m_isolate);
    131131
    132132    // Insert the object instance as the prototype of the shadow object.
Note: See TracChangeset for help on using the changeset viewer.