[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 18:10:08 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 1deafb1ed26f09115776fed28b93f9fab7b1be79
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 2 20:48:21 2010 +0000
2010-03-02 Mads Ager <ager at chromium.org>
Reviewed by Adam Barth.
[V8] V8 should be notified of context disposals
https://bugs.webkit.org/show_bug.cgi?id=35526
Notify V8 of context disposals to allow it to clean up memory from those
contexts when idle. When disposing a context, start a timer that will
give V8 an idle notification after a while to force cleanup. Use a timer
to avoid performing an idle notification in the middle of navigation where
we know we are not idle.
* WebCore.gypi:
* bindings/v8/V8DOMWindowShell.cpp:
(WebCore::V8DOMWindowShell::disposeContextHandles):
* bindings/v8/V8GCForContextDispose.cpp: Added.
(WebCore::V8GCForContextDispose::V8GCForContextDispose):
(WebCore::V8GCForContextDispose::notifyContextDisposed):
(WebCore::V8GCForContextDispose::notifyIdleSooner):
(WebCore::V8GCForContextDispose::instance):
(WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
* bindings/v8/V8GCForContextDispose.h: Added.
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::WindowSetTimeoutImpl):
2010-03-02 Mads Ager <ager at chromium.org>
Reviewed by Adam Barth.
[V8] V8 should be notified of context disposals
https://bugs.webkit.org/show_bug.cgi?id=35526
Update V8 DEPS in order to get V8 API changes needed for context
disposal notifications.
* DEPS:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 24d7cf3..5028cd1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-03-02 Mads Ager <ager at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [V8] V8 should be notified of context disposals
+ https://bugs.webkit.org/show_bug.cgi?id=35526
+
+ Notify V8 of context disposals to allow it to clean up memory from those
+ contexts when idle. When disposing a context, start a timer that will
+ give V8 an idle notification after a while to force cleanup. Use a timer
+ to avoid performing an idle notification in the middle of navigation where
+ we know we are not idle.
+
+ * WebCore.gypi:
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::disposeContextHandles):
+ * bindings/v8/V8GCForContextDispose.cpp: Added.
+ (WebCore::V8GCForContextDispose::V8GCForContextDispose):
+ (WebCore::V8GCForContextDispose::notifyContextDisposed):
+ (WebCore::V8GCForContextDispose::notifyIdleSooner):
+ (WebCore::V8GCForContextDispose::instance):
+ (WebCore::V8GCForContextDispose::pseudoIdleTimerFired):
+ * bindings/v8/V8GCForContextDispose.h: Added.
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::WindowSetTimeoutImpl):
+
2010-03-02 Pavel Feldman <pfeldman at chromium.org>
Not reviewed: adding missing image files to WebKit.qrc and gypi.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 1910869..182e209 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -857,6 +857,8 @@
'bindings/v8/V8EventListenerList.h',
'bindings/v8/V8GCController.cpp',
'bindings/v8/V8GCController.h',
+ 'bindings/v8/V8GCForContextDispose.cpp',
+ 'bindings/v8/V8GCForContextDispose.h',
'bindings/v8/V8Helpers.cpp',
'bindings/v8/V8Helpers.h',
'bindings/v8/V8HiddenPropertyName.cpp',
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index b059999..bdc2c1f 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -51,6 +51,7 @@
#include "V8DOMMap.h"
#include "V8DOMWindow.h"
#include "V8Document.h"
+#include "V8GCForContextDispose.h"
#include "V8HiddenPropertyName.h"
#include "V8History.h"
#include "V8Index.h"
@@ -150,6 +151,11 @@ void V8DOMWindowShell::disposeContextHandles()
m_frame->loader()->client()->didDestroyScriptContextForFrame();
m_context.Dispose();
m_context.Clear();
+
+ // 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();
}
if (!m_wrapperBoilerplates.IsEmpty()) {
diff --git a/WebCore/bindings/v8/V8GCForContextDispose.cpp b/WebCore/bindings/v8/V8GCForContextDispose.cpp
new file mode 100644
index 0000000..06a0555
--- /dev/null
+++ b/WebCore/bindings/v8/V8GCForContextDispose.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8GCForContextDispose.h"
+
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+V8GCForContextDispose::V8GCForContextDispose()
+ : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired)
+{
+}
+
+void V8GCForContextDispose::notifyContextDisposed()
+{
+ v8::V8::ContextDisposedNotification();
+ if (!m_pseudoIdleTimer.isActive())
+ m_pseudoIdleTimer.startOneShot(0.8);
+}
+
+void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval)
+{
+ if (m_pseudoIdleTimer.isActive()) {
+ double nextFireInterval = m_pseudoIdleTimer.nextFireInterval();
+ if (nextFireInterval > maximumFireInterval) {
+ m_pseudoIdleTimer.stop();
+ m_pseudoIdleTimer.startOneShot(maximumFireInterval);
+ }
+ }
+}
+
+V8GCForContextDispose& V8GCForContextDispose::instance()
+{
+ DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ());
+ return staticInstance;
+}
+
+void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*)
+{
+ v8::V8::IdleNotification();
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/v8/V8GCForContextDispose.h b/WebCore/bindings/v8/V8GCForContextDispose.h
new file mode 100644
index 0000000..b15c5af
--- /dev/null
+++ b/WebCore/bindings/v8/V8GCForContextDispose.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef V8GCForContextDispose_h
+#define V8GCForContextDispose_h
+
+#include "Timer.h"
+#include <v8.h>
+
+namespace WebCore {
+
+class V8GCForContextDispose {
+public:
+ void notifyContextDisposed();
+ void notifyIdleSooner(double maximumFireInterval);
+
+ static V8GCForContextDispose& instance();
+
+private:
+ V8GCForContextDispose(); // Use instance() instead.
+ void pseudoIdleTimerFired(Timer<V8GCForContextDispose>*);
+
+ Timer<V8GCForContextDispose> m_pseudoIdleTimer;
+};
+
+}
+
+#endif // V8GCForContextDispose_h
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 93e34b3..e9f7ca8 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -55,6 +55,7 @@
#include "V8BindingDOMWindow.h"
#include "V8BindingState.h"
#include "V8CustomEventListener.h"
+#include "V8GCForContextDispose.h"
#include "V8HTMLCollection.h"
#include "V8MessagePortCustom.h"
#include "V8Node.h"
@@ -135,6 +136,13 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl
id = DOMTimer::install(scriptContext, new ScheduledAction(V8Proxy::context(imp->frame()), functionString), timeout, singleShot);
}
+ // Try to do the idle notification before the timeout expires to get better
+ // use of any idle time. Aim for the middle of the interval for simplicity.
+ if (timeout > 0) {
+ double maximumFireInterval = static_cast<double>(timeout) / 1000 / 2;
+ V8GCForContextDispose::instance().notifyIdleSooner(maximumFireInterval);
+ }
+
return v8::Integer::New(id);
}
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 8068f70..61cb009 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-03-02 Mads Ager <ager at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ [V8] V8 should be notified of context disposals
+ https://bugs.webkit.org/show_bug.cgi?id=35526
+
+ Update V8 DEPS in order to get V8 API changes needed for context
+ disposal notifications.
+
+ * DEPS:
+
2010-03-02 Kenneth Russell <kbr at google.com>
Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/DEPS b/WebKit/chromium/DEPS
index fb4265d..3b566f5 100644
--- a/WebKit/chromium/DEPS
+++ b/WebKit/chromium/DEPS
@@ -43,7 +43,7 @@ vars = {
'openvcdiff_rev': '28',
'ots_rev': '26',
'skia_rev': '490',
- 'v8_rev': '3963',
+ 'v8_rev': '3985',
# Windows:
'cygwin_rev': '11984',
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list