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

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

Issue 2575923002: Make sure pages that are closing but not yet closed are still suspended (non-preferred approach). (Closed)
Patch Set: . Created 4 years 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 0fb749217d8d06e6504136175415ac9bfb220106..b50ea01041ec455c10b03e7af81fb8cdfc95eca5 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -63,13 +63,18 @@ 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;
+}
+
+Page::PageSet& Page::willBeClosedOrdinaryPages() {
+ DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
+ return pages;
}
void Page::networkStateChanged(bool online) {
@@ -512,10 +517,13 @@ void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) {
}
void Page::willBeClosed() {
+ DCHECK(!ScopedPageSuspender::isActive());
ordinaryPages().remove(this);
+ willBeClosedOrdinaryPages().add(this);
}
void Page::willBeDestroyed() {
+ DCHECK(!ScopedPageSuspender::isActive());
Frame* mainFrame = m_mainFrame;
mainFrame->detach(FrameDetachType::Remove);
@@ -523,6 +531,7 @@ void Page::willBeDestroyed() {
ASSERT(allPages().contains(this));
allPages().remove(this);
ordinaryPages().remove(this);
+ willBeClosedOrdinaryPages().remove(this);
if (m_scrollingCoordinator)
m_scrollingCoordinator->willBeDestroyed();
« 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