Title: [135687] trunk/Source/WebCore
- Revision
- 135687
- Author
- commit-qu...@webkit.org
- Date
- 2012-11-26 00:10:35 -0800 (Mon, 26 Nov 2012)
Log Message
[V8] Give isolated shells a lifecycle like that of main shells
https://bugs.webkit.org/show_bug.cgi?id=96522
Patch by Dan Carney <dcar...@google.com> on 2012-11-26
Reviewed by Adam Barth.
Refactored the isolated shells in ScriptController
to be cleaned up the same way the main shell is.
No new tests. No change in functionality.
* bindings/v8/ScriptController.cpp:
(WebCore::ScriptController::~ScriptController):
(WebCore::ScriptController::clearForOutOfMemory):
(WebCore::ScriptController::clearForClose):
(WebCore::ScriptController::clearWindowShell):
* bindings/v8/ScriptController.h:
(ScriptController):
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::destroyIsolatedShell):
(WebCore::V8DOMWindowShell::clearForClose):
* bindings/v8/V8DOMWindowShell.h:
(V8DOMWindowShell):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135686 => 135687)
--- trunk/Source/WebCore/ChangeLog 2012-11-26 07:54:56 UTC (rev 135686)
+++ trunk/Source/WebCore/ChangeLog 2012-11-26 08:10:35 UTC (rev 135687)
@@ -1,3 +1,28 @@
+2012-11-26 Dan Carney <dcar...@google.com>
+
+ [V8] Give isolated shells a lifecycle like that of main shells
+ https://bugs.webkit.org/show_bug.cgi?id=96522
+
+ Reviewed by Adam Barth.
+
+ Refactored the isolated shells in ScriptController
+ to be cleaned up the same way the main shell is.
+
+ No new tests. No change in functionality.
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::~ScriptController):
+ (WebCore::ScriptController::clearForOutOfMemory):
+ (WebCore::ScriptController::clearForClose):
+ (WebCore::ScriptController::clearWindowShell):
+ * bindings/v8/ScriptController.h:
+ (ScriptController):
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::destroyIsolatedShell):
+ (WebCore::V8DOMWindowShell::clearForClose):
+ * bindings/v8/V8DOMWindowShell.h:
+ (V8DOMWindowShell):
+
2012-11-25 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r135656.
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (135686 => 135687)
--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-11-26 07:54:56 UTC (rev 135686)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-11-26 08:10:35 UTC (rev 135687)
@@ -112,8 +112,7 @@
ScriptController::~ScriptController()
{
- m_windowShell->destroyGlobal();
- clearForClose();
+ clearForClose(true);
}
void ScriptController::clearScriptObjects()
@@ -145,27 +144,23 @@
#endif
}
-void ScriptController::reset()
+void ScriptController::clearForOutOfMemory()
{
- for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin();
- iter != m_isolatedWorlds.end(); ++iter) {
- iter->value->destroyIsolatedShell();
- }
- m_isolatedWorlds.clear();
- V8GCController::hintForCollectGarbage();
+ clearForClose(true);
}
-void ScriptController::clearForOutOfMemory()
+void ScriptController::clearForClose(bool destroyGlobal)
{
- clearForClose();
- m_windowShell->destroyGlobal();
+ m_windowShell->clearForClose(destroyGlobal);
+ for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin(); iter != m_isolatedWorlds.end(); ++iter)
+ iter->value->clearForClose(destroyGlobal);
+ V8GCController::hintForCollectGarbage();
}
void ScriptController::clearForClose()
{
double start = currentTime();
- reset();
- m_windowShell->clearForClose();
+ clearForClose(false);
HistogramSupport::histogramCustomCounts("WebCore.ScriptController.clearForClose", (currentTime() - start) * 1000, 0, 10000, 50);
}
@@ -655,10 +650,12 @@
void ScriptController::clearWindowShell(DOMWindow*, bool)
{
double start = currentTime();
- reset();
// V8 binding expects ScriptController::clearWindowShell only be called
// when a frame is loading a new page. This creates a new context for the new page.
m_windowShell->clearForNavigation();
+ for (IsolatedWorldMap::iterator iter = m_isolatedWorlds.begin(); iter != m_isolatedWorlds.end(); ++iter)
+ iter->value->clearForNavigation();
+ V8GCController::hintForCollectGarbage();
HistogramSupport::histogramCustomCounts("WebCore.ScriptController.clearWindowShell", (currentTime() - start) * 1000, 0, 10000, 50);
}
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (135686 => 135687)
--- trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-11-26 07:54:56 UTC (rev 135686)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-11-26 08:10:35 UTC (rev 135687)
@@ -195,7 +195,7 @@
private:
typedef HashMap<int, OwnPtr<V8DOMWindowShell> > IsolatedWorldMap;
- void reset();
+ void clearForClose(bool destroyGlobal);
Frame* m_frame;
const String* m_sourceURL;
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (135686 => 135687)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-11-26 07:54:56 UTC (rev 135686)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-11-26 08:10:35 UTC (rev 135687)
@@ -102,7 +102,7 @@
v8::HandleScope handleScope;
m_world->makeContextWeak(m_context.get());
disposeContext();
- destroyGlobal();
+ m_global.clear();
}
void V8DOMWindowShell::disposeContext()
@@ -123,13 +123,11 @@
V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame);
}
-void V8DOMWindowShell::destroyGlobal()
+void V8DOMWindowShell::clearForClose(bool destroyGlobal)
{
- m_global.clear();
-}
+ if (destroyGlobal)
+ m_global.clear();
-void V8DOMWindowShell::clearForClose()
-{
if (m_context.isEmpty())
return;
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h (135686 => 135687)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2012-11-26 07:54:56 UTC (rev 135686)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2012-11-26 08:10:35 UTC (rev 135687)
@@ -74,10 +74,8 @@
void updateDocumentWrapper(v8::Handle<v8::Object> wrapper);
void clearForNavigation();
- void clearForClose();
+ void clearForClose(bool destroyGlobal);
- void destroyGlobal();
-
DOMWrapperWorld* world() { return m_world.get(); }
void destroyIsolatedShell();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes