[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

barraclough at apple.com barraclough at apple.com
Wed Apr 7 23:30:25 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b8c622389f8f3116b781f103d011b0352ba27ab5
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 11 07:56:52 2009 +0000

    Simplify the ownership model for worlds - rather than having a pair of weak references
    between DOMWrapperWorld and ScriptController/ScriptCachedFrameData, give the latter an
    ref pointer to the former.  This reduces complexity & cost of the caching entries in the
    back forward cache.
    
    Patch by Gavin Barraclough <barraclough at apple.com> on 2009-11-10
    Reviewed by Geoff Garen.
    
    * WebCore.base.exp:
    * bindings/js/JSDOMBinding.cpp:
    (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
    * bindings/js/JSDOMBinding.h:
    (WebCore::DOMWrapperWorld::forgetDocument):
    * bindings/js/ScriptCachedFrameData.cpp:
    (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
    (WebCore::ScriptCachedFrameData::restore):
    (WebCore::ScriptCachedFrameData::clear):
    * bindings/js/ScriptCachedFrameData.h:
    * bindings/js/ScriptController.cpp:
    (WebCore::ScriptController::~ScriptController):
    (WebCore::ScriptController::clearWindowShell):
    (WebCore::ScriptController::initScript):
    (WebCore::ScriptController::updateDocument):
    * bindings/js/ScriptController.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50792 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0a69960..ce43187 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2009-11-10  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Geoff Garen.
+
+        Simplify the ownership model for worlds - rather than having a pair of weak references
+        between DOMWrapperWorld and ScriptController/ScriptCachedFrameData, give the latter an
+        ref pointer to the former.  This reduces complexity & cost of the caching entries in the
+        back forward cache.
+
+        * WebCore.base.exp:
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::DOMWrapperWorld::forgetDocument):
+        * bindings/js/ScriptCachedFrameData.cpp:
+        (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+        (WebCore::ScriptCachedFrameData::restore):
+        (WebCore::ScriptCachedFrameData::clear):
+        * bindings/js/ScriptCachedFrameData.h:
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::~ScriptController):
+        (WebCore::ScriptController::clearWindowShell):
+        (WebCore::ScriptController::initScript):
+        (WebCore::ScriptController::updateDocument):
+        * bindings/js/ScriptController.h:
+
 2009-11-10  Shinichiro Hamaji  <hamaji at chromium.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index b4b148f..9769f46 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -338,6 +338,7 @@ __ZN7WebCore15DatabaseTracker7originsERN3WTF6VectorINS1_6RefPtrINS_14SecurityOri
 __ZN7WebCore15DatabaseTracker7trackerEv
 __ZN7WebCore15DatabaseTracker8setQuotaEPNS_14SecurityOriginEy
 __ZN7WebCore15DatabaseTracker9setClientEPNS_21DatabaseTrackerClientE
+__ZN7WebCore15DOMWrapperWorldD1Ev
 __ZN7WebCore15FocusController10setFocusedEb
 __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 26427f0..11a73fb 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -168,10 +168,6 @@ DOMWrapperWorld::~DOMWrapperWorld()
 
     for (HashSet<Document*>::iterator iter = documentsWithWrappers.begin(); iter != documentsWithWrappers.end(); ++iter)
         forgetWorldOfDOMNodesForDocument(*iter, this);
-    for (HashSet<ScriptController*>::iterator iter = scriptControllersWithShells.begin(); iter != scriptControllersWithShells.end(); ++iter)
-        (*iter)->forgetWorld(this);
-    for (HashSet<ScriptCachedFrameData*>::iterator iter = backForwardCachesWithShells.begin(); iter != backForwardCachesWithShells.end(); ++iter)
-        (*iter)->forgetWorld(this);
 }
 
 EnterDOMWrapperWorld::EnterDOMWrapperWorld(JSC::JSGlobalData& globalData, DOMWrapperWorld* isolatedWorld)
diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h
index c3d75d1..0f9f66f 100644
--- a/WebCore/bindings/js/JSDOMBinding.h
+++ b/WebCore/bindings/js/JSDOMBinding.h
@@ -148,10 +148,6 @@ namespace WebCore {
 
         void rememberDocument(Document* document) { documentsWithWrappers.add(document); }
         void forgetDocument(Document* document) { documentsWithWrappers.remove(document); }
-        void rememberScriptController(ScriptController* scriptController) { scriptControllersWithShells.add(scriptController); }
-        void forgetScriptController(ScriptController* scriptController) { scriptControllersWithShells.remove(scriptController); }
-        void rememberScriptCachedFrameData(ScriptCachedFrameData* backForwardCache) { backForwardCachesWithShells.add(backForwardCache); }
-        void forgetScriptCachedFrameData(ScriptCachedFrameData* backForwardCache) { backForwardCachesWithShells.remove(backForwardCache); }
 
         // FIXME: can we make this private?
         DOMObjectWrapperMap m_wrappers;
@@ -159,8 +155,6 @@ namespace WebCore {
     private:
         JSC::JSGlobalData* m_globalData;
         HashSet<Document*> documentsWithWrappers;
-        HashSet<ScriptController*> scriptControllersWithShells;
-        HashSet<ScriptCachedFrameData*> backForwardCachesWithShells;
     };
 
     // Map from static HashTable instances to per-GlobalData ones.
diff --git a/WebCore/bindings/js/ScriptCachedFrameData.cpp b/WebCore/bindings/js/ScriptCachedFrameData.cpp
index 1908102..f2b64de 100644
--- a/WebCore/bindings/js/ScriptCachedFrameData.cpp
+++ b/WebCore/bindings/js/ScriptCachedFrameData.cpp
@@ -53,23 +53,14 @@ ScriptCachedFrameData::ScriptCachedFrameData(Frame* frame)
 
     ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
     for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
-        DOMWrapperWorld* world = iter->first;
         JSDOMWindow* window = iter->second->window();
-        
-        world->rememberScriptCachedFrameData(this);
-        m_windows.add(world, window);
-
+        m_windows.add(iter->first.get(), window);
         m_domWindow = window->impl();
     }
 
     scriptController->attachDebugger(0);
 }
 
-void ScriptCachedFrameData::forgetWorld(DOMWrapperWorld* world)
-{
-    m_windows.remove(world);
-}
-
 DOMWindow* ScriptCachedFrameData::domWindow() const
 {
     return m_domWindow;
@@ -91,7 +82,7 @@ void ScriptCachedFrameData::restore(Frame* frame)
 
     ScriptController::ShellMap::iterator windowShellsEnd = windowShells.end();
     for (ScriptController::ShellMap::iterator iter = windowShells.begin(); iter != windowShellsEnd; ++iter) {
-        DOMWrapperWorld* world = iter->first;
+        DOMWrapperWorld* world = iter->first.get();
         JSDOMWindowShell* windowShell = iter->second.get();
 
         if (JSDOMWindow* window = m_windows.get(world))
@@ -112,12 +103,6 @@ void ScriptCachedFrameData::clear()
         return;
 
     JSLock lock(SilenceAssertionsOnly);
-
-    for (JSDOMWindowSet::iterator iter = m_windows.begin(); iter != m_windows.end(); ++iter) {
-        DOMWrapperWorld* world = iter->first;
-        world->forgetScriptCachedFrameData(this);
-    }
-
     m_windows.clear();
     gcController().garbageCollectSoon();
 }
diff --git a/WebCore/bindings/js/ScriptCachedFrameData.h b/WebCore/bindings/js/ScriptCachedFrameData.h
index 21422ba..5bcaed7 100644
--- a/WebCore/bindings/js/ScriptCachedFrameData.h
+++ b/WebCore/bindings/js/ScriptCachedFrameData.h
@@ -41,7 +41,7 @@ namespace WebCore {
     class DOMWrapperWorld;
 
     class ScriptCachedFrameData  {
-        typedef HashMap<DOMWrapperWorld*, JSC::ProtectedPtr<JSDOMWindow> > JSDOMWindowSet;
+        typedef HashMap< RefPtr<DOMWrapperWorld>, JSC::ProtectedPtr<JSDOMWindow> > JSDOMWindowSet;
 
     public:
         ScriptCachedFrameData(Frame*);
@@ -50,7 +50,6 @@ namespace WebCore {
         void restore(Frame*);
         void clear();
         DOMWindow* domWindow() const;
-        void forgetWorld(DOMWrapperWorld*);
 
     private:
         JSDOMWindowSet m_windows;
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index d549585..ec39eef 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -81,9 +81,6 @@ ScriptController::ScriptController(Frame* frame)
 ScriptController::~ScriptController()
 {
     if (!m_windowShells.isEmpty()) {
-        for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter)
-            iter->first->forgetScriptController(this);
-
         m_windowShells.clear();
     
         // It's likely that releasing the global object has created a lot of garbage.
@@ -218,7 +215,7 @@ void ScriptController::clearWindowShell()
     attachDebugger(0);
 
     for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter) {
-        DOMWrapperWorld* world = iter->first;
+        DOMWrapperWorld* world = iter->first.get();
         JSDOMWindowShell* windowShell = iter->second;
         windowShell->window()->willRemoveFromWindowShell();
         windowShell->setWindow(m_frame->domWindow());
@@ -242,7 +239,6 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world)
 
     JSDOMWindowShell* windowShell = new JSDOMWindowShell(m_frame->domWindow());
     m_windowShells.add(world, windowShell);
-    world->rememberScriptController(this);
     windowShell->window()->updateDocument(world);
 
     if (Page* page = m_frame->page()) {
@@ -347,7 +343,7 @@ void ScriptController::updateDocument()
 
     JSLock lock(SilenceAssertionsOnly);
     for (ShellMap::iterator iter = m_windowShells.begin(); iter != m_windowShells.end(); ++iter)
-        iter->second->window()->updateDocument(iter->first);
+        iter->second->window()->updateDocument(iter->first.get());
 }
 
 void ScriptController::updateSecurityOrigin()
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index 0bdc207..3344458 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -64,7 +64,7 @@ typedef HashMap<void*, RefPtr<JSC::Bindings::RootObject> > RootObjectMap;
 
 class ScriptController {
     friend class ScriptCachedFrameData;
-    typedef WTF::HashMap<DOMWrapperWorld*, JSC::ProtectedPtr<JSDOMWindowShell> > ShellMap;
+    typedef WTF::HashMap< RefPtr<DOMWrapperWorld>, JSC::ProtectedPtr<JSDOMWindowShell> > ShellMap;
 
 public:
     ScriptController(Frame*);
@@ -86,11 +86,6 @@ public:
     }
     JSDOMWindow* globalObject(unsigned worldID);
 
-    void forgetWorld(DOMWrapperWorld* world)
-    {
-        m_windowShells.remove(world);
-    }
-
     ScriptValue executeScript(const ScriptSourceCode&);
     ScriptValue executeScript(const String& script, bool forceUserGesture = false);
     ScriptValue executeScriptInIsolatedWorld(unsigned worldID, const String& script, bool forceUserGesture = false);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list