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

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

Issue 1507633003: Clarify ordinary page handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whitespace Created 4 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/ScopedPageLoadDeferrer.cpp
diff --git a/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp b/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
index 1aec6fb67e566b15cadbd332ae6db8f6b4242bbb..9ef36dc6860529ac2168ac77ac670d6186a40bae 100644
--- a/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
+++ b/third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp
@@ -32,41 +32,36 @@ namespace blink {
ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion)
{
- const WillBePersistentHeapHashSet<RawPtrWillBeWeakMember<Page>>& pages = Page::ordinaryPages();
- for (const Page* page : pages) {
+ for (const Page* page : Page::ordinaryPages()) {
if (page == exclusion || page->defersLoading())
continue;
- if (page->mainFrame()->isLocalFrame()) {
- m_deferredFrames.append(page->deprecatedLocalMainFrame());
+ if (!page->mainFrame()->isLocalFrame())
+ continue;
- // Ensure that we notify the client if the initial empty document is accessed before
- // showing anything modal, to prevent spoofs while the modal window or sheet is visible.
- page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAccessed();
- }
- }
+ m_deferredFrames.append(page->deprecatedLocalMainFrame());
- size_t count = m_deferredFrames.size();
- for (size_t i = 0; i < count; ++i) {
- if (Page* page = m_deferredFrames[i]->page())
- page->setDefersLoading(true);
+ // Ensure that we notify the client if the initial empty document is accessed before
+ // showing anything modal, to prevent spoofs while the modal window or sheet is visible.
+ page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAccessed();
}
+
+ setDefersLoading(true);
Platform::current()->currentThread()->scheduler()->suspendTimerQueue();
}
-void ScopedPageLoadDeferrer::detach()
+ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
{
- for (size_t i = 0; i < m_deferredFrames.size(); ++i) {
- if (Page* page = m_deferredFrames[i]->page())
- page->setDefersLoading(false);
- }
-
+ setDefersLoading(false);
Platform::current()->currentThread()->scheduler()->resumeTimerQueue();
}
-ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
+void ScopedPageLoadDeferrer::setDefersLoading(bool isDeferred)
{
- detach();
+ for (const auto& frame : m_deferredFrames) {
+ if (Page* page = frame->page())
+ page->setDefersLoading(isDeferred);
+ }
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698