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

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

Issue 172513002: Rename PageGroupLoadDeferrer to ScopedPageLoadDeferrer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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
« no previous file with comments | « Source/core/page/ScopedPageLoadDeferrer.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/ScopedPageLoadDeferrer.cpp
diff --git a/Source/core/page/PageGroupLoadDeferrer.cpp b/Source/core/page/ScopedPageLoadDeferrer.cpp
similarity index 61%
rename from Source/core/page/PageGroupLoadDeferrer.cpp
rename to Source/core/page/ScopedPageLoadDeferrer.cpp
index be7e7c24508ced1cdffa0f0ecfd9b3a66730e1b7..05c991ac78415a295ec0a97e180c56124ad1c17b 100644
--- a/Source/core/page/PageGroupLoadDeferrer.cpp
+++ b/Source/core/page/ScopedPageLoadDeferrer.cpp
@@ -19,11 +19,11 @@
*/
#include "config.h"
-#include "core/page/PageGroupLoadDeferrer.h"
+#include "core/page/ScopedPageLoadDeferrer.h"
#include "core/dom/Document.h"
-#include "core/loader/FrameLoader.h"
#include "core/frame/Frame.h"
+#include "core/loader/FrameLoader.h"
#include "core/page/Page.h"
#include "core/page/PageGroup.h"
#include "wtf/HashSet.h"
@@ -32,36 +32,36 @@ namespace WebCore {
using namespace std;
-PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
+ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion)
{
- const HashSet<Page*>& pages = page->group().pages();
+ const HashSet<Page*>& pages = PageGroup::sharedGroup()->pages();
HashSet<Page*>::const_iterator end = pages.end();
for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
- Page* otherPage = *it;
- if ((deferSelf || otherPage != page)) {
- if (!otherPage->defersLoading()) {
- m_deferredFrames.append(otherPage->mainFrame());
+ Page* page = *it;
+ if (page == exclusion || page->defersLoading())
+ 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.
- otherPage->mainFrame()->loader().notifyIfInitialDocumentAccessed();
+ m_deferredFrames.append(page->mainFrame());
- // This code is not logically part of load deferring, but we do not want JS code executed beneath modal
- // windows or sheets, which is exactly when PageGroupLoadDeferrer is used.
- for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree().traverseNext())
- frame->document()->suspendScheduledTasks();
- }
- }
+ // 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->mainFrame()->loader().notifyIfInitialDocumentAccessed();
+
+ // This code is not logically part of load deferring, but we do not want JS code executed
+ // beneath modal windows or sheets, which is exactly when ScopedPageLoadDeferrer is used.
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree().traverseNext())
+ frame->document()->suspendScheduledTasks();
}
size_t count = m_deferredFrames.size();
- for (size_t i = 0; i < count; ++i)
+ for (size_t i = 0; i < count; ++i) {
if (Page* page = m_deferredFrames[i]->page())
page->setDefersLoading(true);
+ }
}
-PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
+ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
{
for (size_t i = 0; i < m_deferredFrames.size(); ++i) {
if (Page* page = m_deferredFrames[i]->page()) {
@@ -73,5 +73,4 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
}
}
-
} // namespace WebCore
« no previous file with comments | « Source/core/page/ScopedPageLoadDeferrer.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698