Changeset 52937 in webkit


Ignore:
Timestamp:
Jan 7, 2010 12:00:38 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-01-07 Adam Barth <abarth@webkit.org>

No review, rolling out r52847.
http://trac.webkit.org/changeset/52847
https://bugs.webkit.org/show_bug.cgi?id=33232

Might have caused a perf regression. I'm rolling this out to see if it
heals the perf bot.

  • bindings/v8/ScriptController.cpp: (WebCore::ScriptController::ScriptController): (WebCore::ScriptController::~ScriptController): (WebCore::ScriptController::updateSecurityOrigin): (WebCore::ScriptController::evaluateInIsolatedWorld): (WebCore::ScriptController::haveInterpreter): (WebCore::ScriptController::clearWindowShell): (WebCore::ScriptController::updateDocument):
  • bindings/v8/ScriptController.h:
  • bindings/v8/V8DOMWindowShell.cpp:
  • bindings/v8/V8DOMWindowShell.h:
  • bindings/v8/V8DOMWrapper.cpp: (WebCore::V8DOMWrapper::instantiateV8Object): (WebCore::V8DOMWrapper::convertDocumentToV8Object): (WebCore::V8DOMWrapper::convertNewNodeToV8Object):
  • bindings/v8/V8IsolatedContext.cpp: (WebCore::V8IsolatedContext::V8IsolatedContext):
  • bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::V8Proxy): (WebCore::V8Proxy::~V8Proxy): (WebCore::V8Proxy::handleOutOfMemory): (WebCore::V8Proxy::evaluateInIsolatedWorld): (WebCore::V8Proxy::setInjectedScriptContextDebugId): (WebCore::V8Proxy::clearForClose): (WebCore::V8Proxy::clearForNavigation): (WebCore::V8Proxy::context): (WebCore::V8Proxy::mainWorldContext): (WebCore::V8Proxy::currentContext): (WebCore::V8Proxy::setContextDebugId):
  • bindings/v8/V8Proxy.h: (WebCore::V8Proxy::windowShell):
  • bindings/v8/WorldContextHandle.cpp: (WebCore::WorldContextHandle::adjustedContext):

2010-01-07 Adam Barth <abarth@webkit.org>

No review, rolling out r52847.
http://trac.webkit.org/changeset/52847
https://bugs.webkit.org/show_bug.cgi?id=33232

Might have caused a perf regression.

  • src/FrameLoaderClientImpl.cpp: (WebKit::FrameLoaderClientImpl::detachedFromParent3):
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52933 r52937  
     12010-01-07  Adam Barth  <abarth@webkit.org>
     2
     3        No review, rolling out r52847.
     4        http://trac.webkit.org/changeset/52847
     5        https://bugs.webkit.org/show_bug.cgi?id=33232
     6
     7        Might have caused a perf regression.  I'm rolling this out to see if it
     8        heals the perf bot.
     9
     10        * bindings/v8/ScriptController.cpp:
     11        (WebCore::ScriptController::ScriptController):
     12        (WebCore::ScriptController::~ScriptController):
     13        (WebCore::ScriptController::updateSecurityOrigin):
     14        (WebCore::ScriptController::evaluateInIsolatedWorld):
     15        (WebCore::ScriptController::haveInterpreter):
     16        (WebCore::ScriptController::clearWindowShell):
     17        (WebCore::ScriptController::updateDocument):
     18        * bindings/v8/ScriptController.h:
     19        * bindings/v8/V8DOMWindowShell.cpp:
     20        * bindings/v8/V8DOMWindowShell.h:
     21        * bindings/v8/V8DOMWrapper.cpp:
     22        (WebCore::V8DOMWrapper::instantiateV8Object):
     23        (WebCore::V8DOMWrapper::convertDocumentToV8Object):
     24        (WebCore::V8DOMWrapper::convertNewNodeToV8Object):
     25        * bindings/v8/V8IsolatedContext.cpp:
     26        (WebCore::V8IsolatedContext::V8IsolatedContext):
     27        * bindings/v8/V8Proxy.cpp:
     28        (WebCore::V8Proxy::V8Proxy):
     29        (WebCore::V8Proxy::~V8Proxy):
     30        (WebCore::V8Proxy::handleOutOfMemory):
     31        (WebCore::V8Proxy::evaluateInIsolatedWorld):
     32        (WebCore::V8Proxy::setInjectedScriptContextDebugId):
     33        (WebCore::V8Proxy::clearForClose):
     34        (WebCore::V8Proxy::clearForNavigation):
     35        (WebCore::V8Proxy::context):
     36        (WebCore::V8Proxy::mainWorldContext):
     37        (WebCore::V8Proxy::currentContext):
     38        (WebCore::V8Proxy::setContextDebugId):
     39        * bindings/v8/V8Proxy.h:
     40        (WebCore::V8Proxy::windowShell):
     41        * bindings/v8/WorldContextHandle.cpp:
     42        (WebCore::WorldContextHandle::adjustedContext):
     43
    1442010-01-07  Dan Bernstein  <mitz@apple.com>
    245
  • trunk/WebCore/bindings/v8/ScriptController.cpp

    r52882 r52937  
    107107    , m_paused(false)
    108108    , m_proxy(new V8Proxy(frame))
    109     , m_windowShell(V8DOMWindowShell::create(frame))
    110109#if ENABLE(NETSCAPE_PLUGIN_API)
    111110    , m_windowScriptNPObject(0)
     
    118117{
    119118    m_proxy->disconnectFrame();
    120     m_windowShell.clear();
    121119}
    122120
     
    143141void ScriptController::updateSecurityOrigin()
    144142{
    145     m_windowShell->updateSecurityOrigin();
     143    m_proxy->windowShell()->updateSecurityOrigin();
    146144}
    147145
     
    208206void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources)
    209207{
    210     // FIXME: This will need to get reorganized once we have a windowShell for the isolated world.
    211     m_windowShell->initContextIfNeeded();
    212208    m_proxy->evaluateInIsolatedWorld(worldID, sources, 0);
    213209}
     
    296292bool ScriptController::haveInterpreter() const
    297293{
    298     return m_windowShell->isContextInitialized();
     294    return m_proxy->windowShell()->isContextInitialized();
    299295}
    300296
     
    440436}
    441437
    442 V8DOMWindowShell* ScriptController::mainWorldWindowShell() const
    443 {
    444     m_windowShell->initContextIfNeeded();
    445     return m_windowShell.get();
    446 }
    447438
    448439void ScriptController::clearWindowShell()
    449440{
    450441    m_mainWorldScriptState.clear();
    451     m_proxy->resetIsolatedWorlds();
    452442
    453443    // V8 binding expects ScriptController::clearWindowShell only be called
    454     // when a frame is loading a new page. V8DOMWindowShell::clearForNavigation
     444    // when a frame is loading a new page. V8Proxy::clearForNavigation
    455445    // creates a new context for the new page.
    456     m_windowShell->clearForNavigation();
    457 }
    458 
    459 void ScriptController::clearForClose()
    460 {
    461     m_windowShell->clearForClose();
    462 }
    463 
    464 void ScriptController::destroyWindowShell()
    465 {
    466     m_windowShell->clearForClose();
    467     m_windowShell->destroyGlobal();
     446    m_proxy->clearForNavigation();
    468447}
    469448
     
    475454void ScriptController::updateDocument()
    476455{
    477     m_windowShell->updateDocument();
     456    m_proxy->windowShell()->updateDocument();
    478457}
    479458
  • trunk/WebCore/bindings/v8/ScriptController.h

    r52882 r52937  
    6464    V8Proxy* proxy() { return m_proxy.get(); }
    6565
    66     V8DOMWindowShell* mainWorldWindowShell() const;
    67 
    6866    ScriptValue executeScript(const ScriptSourceCode&);
    6967    ScriptValue executeScript(const String& script, bool forceUserGesture = false);
     
    156154    void updateDocument();
    157155
    158     void clearForClose();
    159 
    160     // This is very destructive (e.g., out of memory).
    161     void destroyWindowShell();
    162 
    163156    void updateSecurityOrigin();
    164157    void clearScriptObjects();
     
    190183    bool m_paused;
    191184
    192     // FIXME: V8Proxy should eventually be removed.
    193185    OwnPtr<V8Proxy> m_proxy;
    194 
    195     // For the moment, we have one of these.  Soon we will have one per DOMWrapperWorld.
    196     RefPtr<V8DOMWindowShell> m_windowShell;
    197 
    198186    typedef HashMap<Widget*, NPObject*> PluginObjectMap;
    199187
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.cpp

    r52882 r52937  
    131131    : m_frame(frame)
    132132{
    133 }
    134 
    135 V8DOMWindowShell::~V8DOMWindowShell()
    136 {
    137     clearForClose();
    138     destroyGlobal();
    139133}
    140134
  • trunk/WebCore/bindings/v8/V8DOMWindowShell.h

    r52867 r52937  
    4747    static PassRefPtr<V8DOMWindowShell> create(Frame*);
    4848
    49     virtual ~V8DOMWindowShell();
    50 
    5149    v8::Handle<v8::Context> context() const { return m_context; }
    52 
    53     // This method is slower than |context()|, but sometimes we need local handles.
    54     v8::Local<v8::Context> localHandleForContext() const { return v8::Local<v8::Context>::New(m_context); }
    5550
    5651    // Update document object of the frame.
     
    7166    void clearForNavigation();
    7267    void clearForClose();
     68
    7369    void destroyGlobal();
    7470
  • trunk/WebCore/bindings/v8/V8DOMWrapper.cpp

    r52867 r52937  
    836836    if (proxy)
    837837        // FIXME: Fix this to work properly with isolated worlds (see above).
    838         instance = proxy->frame()->script()->mainWorldWindowShell()->createWrapperFromCache(descriptorType);
     838        instance = proxy->windowShell()->createWrapperFromCache(descriptorType);
    839839    else {
    840840        v8::Local<v8::Function> function = getTemplate(descriptorType)->GetFunction();
     
    12381238    // checking if the node already has a wrapper.
    12391239    V8Proxy* proxy = V8Proxy::retrieve(document->frame());
    1240     if (proxy) {
    1241         // This code looks wacky:
    1242         // 1) The test for |proxy| above is really a test whether JavaScript
    1243         //    is enabled in this frame.  I have no idea if that's needed.
    1244         // 2) Calling initContextIfNeeded here is redundant becase just
    1245         //    grabbing mainWorldWindowShell() already calls initContextIfNeeded.
    1246         // FIXME: I bet we can clean this up a bit!
    1247         proxy->frame()->script()->mainWorldWindowShell()->initContextIfNeeded();
    1248     }
     1240    if (proxy)
     1241        proxy->windowShell()->initContextIfNeeded();
    12491242
    12501243    DOMWrapperMap<Node>& domNodeMap = getDOMNodeMap();
     
    13351328
    13361329    if (isDocument) {
    1337         if (proxy) {
    1338             // FIXME: Don't we need to do this for every world?
    1339             proxy->frame()->script()->mainWorldWindowShell()->updateDocumentWrapper(result);
    1340         }
     1330        if (proxy)
     1331            proxy->windowShell()->updateDocumentWrapper(result);
    13411332
    13421333        if (type == V8ClassIndex::HTMLDOCUMENT) {
  • trunk/WebCore/bindings/v8/V8IsolatedContext.cpp

    r52847 r52937  
    5454    : m_world(IsolatedWorld::create())
    5555{
    56     // FIXME: None of this code belongs here! Basically, ScriptController
    57     // should create a new DOMWrapperWorld and a new windowShell and then
    58     // evaluate the script.
    59 
    60     V8DOMWindowShell* mainWorldWindowShell = proxy->frame()->script()->mainWorldWindowShell();
    61 
    6256    v8::HandleScope scope;
    6357    // FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context.
    64     m_context = SharedPersistent<v8::Context>::create(mainWorldWindowShell->createNewContext(v8::Handle<v8::Object>(), extensionGroup));
     58    m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup));
    6559    if (m_context->get().IsEmpty())
    6660        return;
     
    7367    V8DOMWindowShell::installHiddenObjectPrototype(m_context->get());
    7468    // FIXME: This will go away once we have a windowShell for the isolated world.
    75     mainWorldWindowShell->installDOMWindow(m_context->get(), proxy->frame()->domWindow());
     69    proxy->windowShell()->installDOMWindow(m_context->get(), proxy->frame()->domWindow());
    7670
    7771    // Using the default security token means that the canAccess is always
  • trunk/WebCore/bindings/v8/V8Proxy.cpp

    r52850 r52937  
    214214V8Proxy::V8Proxy(Frame* frame)
    215215    : m_frame(frame)
     216    , m_windowShell(V8DOMWindowShell::create(frame))
    216217    , m_inlineCode(false)
    217218    , m_timerCallback(false)
     
    222223V8Proxy::~V8Proxy()
    223224{
    224     resetIsolatedWorlds();
     225    clearForClose();
     226    windowShell()->destroyGlobal();
    225227}
    226228
     
    245247    Frame* frame = V8Proxy::retrieveFrame(context);
    246248
    247     frame->script()->destroyWindowShell();
     249    V8Proxy* proxy = V8Proxy::retrieve(frame);
     250    if (proxy) {
     251        // Clean m_context, and event handlers.
     252        proxy->clearForClose();
     253
     254        proxy->windowShell()->destroyGlobal();
     255    }
    248256
    249257    ChromiumBridge::notifyJSOutOfMemory(frame);
     
    259267void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup)
    260268{
     269    // FIXME: This will need to get reorganized once we have a windowShell for the isolated world.
     270    windowShell()->initContextIfNeeded();
     271
    261272    v8::HandleScope handleScope;
    262273    V8IsolatedContext* isolatedContext = 0;
     
    304315    // Setup context id for JS debugger.
    305316    v8::Context::Scope contextScope(targetContext);
    306     v8::Handle<v8::Context> context = m_frame->script()->mainWorldWindowShell()->localHandleForContext();
     317    v8::Handle<v8::Context> context = windowShell()->context();
    307318    if (context.IsEmpty())
    308319        return false;
     
    572583    }
    573584    m_isolatedWorlds.clear();
     585}
     586
     587void V8Proxy::clearForClose()
     588{
     589    resetIsolatedWorlds();
     590    windowShell()->clearForClose();
     591}
     592
     593void V8Proxy::clearForNavigation()
     594{
     595    resetIsolatedWorlds();
     596    windowShell()->clearForNavigation();
    574597}
    575598
     
    633656v8::Local<v8::Context> V8Proxy::context(Frame* frame)
    634657{
    635     // FIXME: Move this function to ScriptController.
    636658    v8::Local<v8::Context> context = V8Proxy::mainWorldContext(frame);
    637659    if (context.IsEmpty())
     
    649671v8::Local<v8::Context> V8Proxy::context()
    650672{
    651     // FIXME: Move this function to ScriptController.
    652673    if (V8IsolatedContext* isolatedContext = V8IsolatedContext::getEntered()) {
    653674        RefPtr<SharedPersistent<v8::Context> > context = isolatedContext->sharedContext();
     
    656677        return v8::Local<v8::Context>::New(context->get());
    657678    }
    658     return m_frame->script()->mainWorldWindowShell()->localHandleForContext();
     679    return mainWorldContext();
     680}
     681
     682v8::Local<v8::Context> V8Proxy::mainWorldContext()
     683{
     684    windowShell()->initContextIfNeeded();
     685    return v8::Local<v8::Context>::New(windowShell()->context());
    659686}
    660687
    661688v8::Local<v8::Context> V8Proxy::mainWorldContext(Frame* frame)
    662689{
    663     // FIXME: Move this function to ScriptController.
    664     if (!frame->script()->isEnabled())
     690    V8Proxy* proxy = retrieve(frame);
     691    if (!proxy)
    665692        return v8::Local<v8::Context>();
    666693
    667     return frame->script()->mainWorldWindowShell()->localHandleForContext();
     694    return proxy->mainWorldContext();
    668695}
    669696
    670697v8::Local<v8::Context> V8Proxy::currentContext()
    671698{
    672     // FIXME: Why does this function exist?
    673699    return v8::Context::GetCurrent();
    674700}
     
    805831{
    806832    ASSERT(debugId > 0);
     833<<<<<<< HEAD
    807834    v8::HandleScope scope;
    808835    v8::Local<v8::Context> context = m_frame->script()->mainWorldWindowShell()->localHandleForContext();
     836=======
     837    v8::Handle<v8::Context> context = windowShell()->context();
     838>>>>>>> 99d3c27... 2010-01-05  Adam Barth  <abarth@webkit.org>
    809839    if (context.IsEmpty())
    810840        return false;
  • trunk/WebCore/bindings/v8/V8Proxy.h

    r52847 r52937  
    153153        Frame* frame() { return m_frame; }
    154154
     155        void clearForNavigation();
     156        void clearForClose();
     157
    155158        // FIXME: Need comment. User Gesture related.
    156159        bool inlineCode() const { return m_inlineCode; }
     
    307310
    308311        v8::Local<v8::Context> context();
     312        v8::Local<v8::Context> mainWorldContext();
     313
     314        // FIXME: This should eventually take DOMWrapperWorld argument!
     315        V8DOMWindowShell* windowShell() const { return m_windowShell.get(); }
    309316
    310317        bool setContextDebugId(int id);
     
    329336        static void reportUnsafeAccessTo(Frame* target, DelayReporting delay);
    330337
    331         // FIXME: This should move to ScriptController.
    332         void resetIsolatedWorlds();
    333 
    334338    private:
    335339        // If m_recursionCount is 0, let LocalStorage know so we can release
    336340        // the storage mutex.
    337341        void releaseStorageMutex();
     342
     343        void resetIsolatedWorlds();
    338344
    339345        // Returns false when we're out of memory in V8.
     
    365371        Frame* m_frame;
    366372
     373        // For the moment, we have one of these.  Soon we will have one per DOMWrapperWorld.
     374        RefPtr<V8DOMWindowShell> m_windowShell;
     375       
    367376        // Utility context holding JavaScript functions used internally.
    368377        static v8::Persistent<v8::Context> m_utilityContext;
  • trunk/WebCore/bindings/v8/WorldContextHandle.cpp

    r52847 r52937  
    3232#include "WorldContextHandle.h"
    3333
    34 #include "Frame.h"
    3534#include "V8IsolatedContext.h"
    3635
     
    5049{
    5150    if (m_worldToUse == UseMainWorld)
    52         return proxy->frame()->script()->mainWorldWindowShell()->localHandleForContext();
     51        return proxy->mainWorldContext();
    5352    if (!m_context || m_context->get().IsEmpty())
    5453        return proxy->context();
  • trunk/WebKit/chromium/ChangeLog

    r52898 r52937  
     12010-01-07  Adam Barth  <abarth@webkit.org>
     2
     3        No review, rolling out r52847.
     4        http://trac.webkit.org/changeset/52847
     5        https://bugs.webkit.org/show_bug.cgi?id=33232
     6
     7        Might have caused a perf regression.
     8
     9        * src/FrameLoaderClientImpl.cpp:
     10        (WebKit::FrameLoaderClientImpl::detachedFromParent3):
     11
    1122010-01-06  Mike Belshe  <mike@belshe.com>
    213
  • trunk/WebKit/chromium/src/FrameLoaderClientImpl.cpp

    r52847 r52937  
    216216    // go to a page and then navigate to a new page without getting any asserts
    217217    // or crashes.
    218     m_webFrame->frame()->script()->clearForClose();
    219 
     218    m_webFrame->frame()->script()->proxy()->clearForClose();
     219   
    220220    // Stop communicating with the WebFrameClient at this point since we are no
    221221    // longer associated with the Page.
Note: See TracChangeset for help on using the changeset viewer.