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

Side by Side Diff: third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp

Issue 2155393002: Fix ScopedPageLoadDeferrer to work with pages that have remote main frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 14 matching lines...) Expand all
25 #include "core/loader/FrameLoader.h" 25 #include "core/loader/FrameLoader.h"
26 #include "core/page/Page.h" 26 #include "core/page/Page.h"
27 #include "public/platform/Platform.h" 27 #include "public/platform/Platform.h"
28 #include "public/platform/WebScheduler.h" 28 #include "public/platform/WebScheduler.h"
29 #include "wtf/HashSet.h" 29 #include "wtf/HashSet.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion) 33 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion)
34 { 34 {
35 for (const Page* page : Page::ordinaryPages()) { 35 for (Page* page : Page::ordinaryPages()) {
36 if (page == exclusion || page->defersLoading()) 36 if (page == exclusion || page->defersLoading())
37 continue; 37 continue;
38 38 m_deferredPages.append(page);
39 if (!page->mainFrame()->isLocalFrame())
40 continue;
41
42 m_deferredFrames.append(page->deprecatedLocalMainFrame());
43 39
44 // Ensure that we notify the client if the initial empty document is acc essed before 40 // Ensure that we notify the client if the initial empty document is acc essed before
45 // showing anything modal, to prevent spoofs while the modal window or s heet is visible. 41 // showing anything modal, to prevent spoofs while the modal window or s heet is visible.
46 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAccess ed(); 42 if (page->mainFrame()->isLocalFrame())
43 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc cessed();
47 } 44 }
48 45
49 setDefersLoading(true); 46 setDefersLoading(true);
50 Platform::current()->currentThread()->scheduler()->suspendTimerQueue(); 47 Platform::current()->currentThread()->scheduler()->suspendTimerQueue();
51 } 48 }
52 49
53 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() 50 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
54 { 51 {
55 setDefersLoading(false); 52 setDefersLoading(false);
56 Platform::current()->currentThread()->scheduler()->resumeTimerQueue(); 53 Platform::current()->currentThread()->scheduler()->resumeTimerQueue();
57 } 54 }
58 55
59 void ScopedPageLoadDeferrer::setDefersLoading(bool isDeferred) 56 void ScopedPageLoadDeferrer::setDefersLoading(bool isDeferred)
60 { 57 {
61 for (const auto& frame : m_deferredFrames) { 58
62 if (Page* page = frame->page()) 59 for (const auto& page : m_deferredPages)
63 page->setDefersLoading(isDeferred); 60 page->setDefersLoading(isDeferred);
64 }
65 } 61 }
66 62
67 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698