Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 2616513002: Make sure pages that are closing but not yet closed are still suspended. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/page/Page.cpp
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
index 9f0f41c7b54da782a8403ff3ba28394b572689b2..b9f74b332f128663880703f66bfdcbcb035f15bd 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -62,13 +62,13 @@ namespace blink {
// Set of all live pages; includes internal Page objects that are
// not observable from scripts.
static Page::PageSet& allPages() {
- DEFINE_STATIC_LOCAL(Page::PageSet, allPages, ());
- return allPages;
+ DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
+ return pages;
}
Page::PageSet& Page::ordinaryPages() {
- DEFINE_STATIC_LOCAL(Page::PageSet, ordinaryPages, ());
- return ordinaryPages;
+ DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
+ return pages;
}
void Page::networkStateChanged(bool online) {
@@ -149,6 +149,17 @@ Page::~Page() {
ASSERT(!m_mainFrame);
}
+void Page::closeSoon() {
+ // Make sure this Page can no longer be found by JS.
+ m_isClosing = true;
+
+ // TODO(dcheng): Try to remove this in a followup, it's not obviously needed.
+ if (m_mainFrame->isLocalFrame())
+ toLocalFrame(m_mainFrame)->loader().stopAllLoaders();
+
+ chromeClient().closeWindowSoon();
+}
+
ViewportDescription Page::viewportDescription() const {
return mainFrame() && mainFrame()->isLocalFrame() &&
deprecatedLocalMainFrame()->document()
@@ -507,10 +518,6 @@ void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) {
m_scrollingCoordinator->willCloseLayerTreeView(layerTreeView);
}
-void Page::willBeClosed() {
- ordinaryPages().remove(this);
-}
-
void Page::willBeDestroyed() {
Frame* mainFrame = m_mainFrame;
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/core/page/ScopedPageSuspender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698