Title: [111586] trunk/Source/WebCore
- Revision
- 111586
- Author
- [email protected]
- Date
- 2012-03-21 11:54:18 -0700 (Wed, 21 Mar 2012)
Log Message
[V8] V8GCForContextDispose should indicate whether a context is disposed for the main frame or not
https://bugs.webkit.org/show_bug.cgi?id=81200
Patch by Ulan Degenbaev <[email protected]> on 2012-03-21
Reviewed by Adam Barth.
Pass a hint to V8::IdleNotification that requests more aggressive GC
when a main frame context is disposed and requests incremental GC otherwise.
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::disposeContextHandles):
* bindings/v8/V8GCForContextDispose.cpp:
(WebCore::V8GCForContextDispose::V8GCForContextDispose):
(WebCore::V8GCForContextDispose::notifyContextDisposed):
(WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
* bindings/v8/V8GCForContextDispose.h:
(V8GCForContextDispose):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (111585 => 111586)
--- trunk/Source/WebCore/ChangeLog 2012-03-21 18:43:21 UTC (rev 111585)
+++ trunk/Source/WebCore/ChangeLog 2012-03-21 18:54:18 UTC (rev 111586)
@@ -1,3 +1,22 @@
+2012-03-21 Ulan Degenbaev <[email protected]>
+
+ [V8] V8GCForContextDispose should indicate whether a context is disposed for the main frame or not
+ https://bugs.webkit.org/show_bug.cgi?id=81200
+
+ Reviewed by Adam Barth.
+
+ Pass a hint to V8::IdleNotification that requests more aggressive GC
+ when a main frame context is disposed and requests incremental GC otherwise.
+
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::disposeContextHandles):
+ * bindings/v8/V8GCForContextDispose.cpp:
+ (WebCore::V8GCForContextDispose::V8GCForContextDispose):
+ (WebCore::V8GCForContextDispose::notifyContextDisposed):
+ (WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
+ * bindings/v8/V8GCForContextDispose.h:
+ (V8GCForContextDispose):
+
2012-03-21 Nat Duca <[email protected]>
[chromium] CCThreadProxy must initialize frameBeginTime to monotonicallyIncreasingTime rather than zero
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (111585 => 111586)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-03-21 18:43:21 UTC (rev 111585)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2012-03-21 18:54:18 UTC (rev 111586)
@@ -180,7 +180,8 @@
// It's likely that disposing the context has created a lot of
// garbage. Notify V8 about this so it'll have a chance of cleaning
// it up when idle.
- V8GCForContextDispose::instance().notifyContextDisposed();
+ bool isMainFrame = m_frame->page() && (m_frame->page()->mainFrame() == m_frame);
+ V8GCForContextDispose::instance().notifyContextDisposed(isMainFrame);
}
WrapperBoilerplateMap::iterator it = m_wrapperBoilerplates.begin();
Modified: trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.cpp (111585 => 111586)
--- trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.cpp 2012-03-21 18:43:21 UTC (rev 111585)
+++ trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.cpp 2012-03-21 18:54:18 UTC (rev 111586)
@@ -37,11 +37,13 @@
V8GCForContextDispose::V8GCForContextDispose()
: m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired)
+ , m_didDisposeContextForMainFrame(false)
{
}
-void V8GCForContextDispose::notifyContextDisposed()
+void V8GCForContextDispose::notifyContextDisposed(bool isMainFrame)
{
+ m_didDisposeContextForMainFrame = m_didDisposeContextForMainFrame || isMainFrame;
v8::V8::ContextDisposedNotification();
if (!m_pseudoIdleTimer.isActive())
m_pseudoIdleTimer.startOneShot(0.8);
@@ -66,7 +68,11 @@
void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*)
{
- v8::V8::IdleNotification();
+ const int longIdlePauseInMs = 1000;
+ const int shortIdlePauseInMs = 10;
+ int hint = m_didDisposeContextForMainFrame ? longIdlePauseInMs : shortIdlePauseInMs;
+ v8::V8::IdleNotification(hint);
+ m_didDisposeContextForMainFrame = false;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.h (111585 => 111586)
--- trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.h 2012-03-21 18:43:21 UTC (rev 111585)
+++ trunk/Source/WebCore/bindings/v8/V8GCForContextDispose.h 2012-03-21 18:54:18 UTC (rev 111586)
@@ -38,7 +38,7 @@
class V8GCForContextDispose {
public:
- void notifyContextDisposed();
+ void notifyContextDisposed(bool isMainFrame);
void notifyIdleSooner(double maximumFireInterval);
static V8GCForContextDispose& instance();
@@ -48,6 +48,7 @@
void pseudoIdleTimerFired(Timer<V8GCForContextDispose>*);
Timer<V8GCForContextDispose> m_pseudoIdleTimer;
+ bool m_didDisposeContextForMainFrame;
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes