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

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

Issue 1316663004: [Oilpan] De-oilpanize ScopedPageLoadDeferrer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/ScopedPageLoadDeferrer.h ('k') | Source/web/WebViewImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 #include "core/dom/Document.h" 24 #include "core/dom/Document.h"
25 #include "core/frame/LocalFrame.h" 25 #include "core/frame/LocalFrame.h"
26 #include "core/loader/FrameLoader.h" 26 #include "core/loader/FrameLoader.h"
27 #include "core/page/Page.h" 27 #include "core/page/Page.h"
28 #include "public/platform/Platform.h" 28 #include "public/platform/Platform.h"
29 #include "public/platform/WebScheduler.h" 29 #include "public/platform/WebScheduler.h"
30 #include "wtf/HashSet.h" 30 #include "wtf/HashSet.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion) : m_detached(fal se) 34 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer(Page* exclusion)
35 { 35 {
36 const HashSet<Page*>& pages = Page::ordinaryPages(); 36 const HashSet<Page*>& pages = Page::ordinaryPages();
37 for (const Page* page : pages) { 37 for (const Page* page : pages) {
38 if (page == exclusion || page->defersLoading()) 38 if (page == exclusion || page->defersLoading())
39 continue; 39 continue;
40 40
41 if (page->mainFrame()->isLocalFrame()) { 41 if (page->mainFrame()->isLocalFrame()) {
42 m_deferredFrames.append(page->deprecatedLocalMainFrame()); 42 m_deferredFrames.append(page->deprecatedLocalMainFrame());
43 43
44 // Ensure that we notify the client if the initial empty document is accessed before 44 // Ensure that we notify the client if the initial empty document is accessed before
45 // showing anything modal, to prevent spoofs while the modal window or sheet is visible. 45 // showing anything modal, to prevent spoofs while the modal window or sheet is visible.
46 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc cessed(); 46 page->deprecatedLocalMainFrame()->loader().notifyIfInitialDocumentAc cessed();
47 } 47 }
48 } 48 }
49 49
50 size_t count = m_deferredFrames.size(); 50 size_t count = m_deferredFrames.size();
51 for (size_t i = 0; i < count; ++i) { 51 for (size_t i = 0; i < count; ++i) {
52 if (Page* page = m_deferredFrames[i]->page()) 52 if (Page* page = m_deferredFrames[i]->page())
53 page->setDefersLoading(true); 53 page->setDefersLoading(true);
54 } 54 }
55 Platform::current()->currentThread()->scheduler()->suspendTimerQueue(); 55 Platform::current()->currentThread()->scheduler()->suspendTimerQueue();
56 } 56 }
57 57
58 void ScopedPageLoadDeferrer::detach() 58 void ScopedPageLoadDeferrer::detach()
59 { 59 {
60 if (m_detached)
61 return;
62
63 for (size_t i = 0; i < m_deferredFrames.size(); ++i) { 60 for (size_t i = 0; i < m_deferredFrames.size(); ++i) {
64 if (Page* page = m_deferredFrames[i]->page()) 61 if (Page* page = m_deferredFrames[i]->page())
65 page->setDefersLoading(false); 62 page->setDefersLoading(false);
66 } 63 }
67 64
68 Platform::current()->currentThread()->scheduler()->resumeTimerQueue(); 65 Platform::current()->currentThread()->scheduler()->resumeTimerQueue();
69 m_detached = true;
70 } 66 }
71 67
72 #if ENABLE(OILPAN)
73 void ScopedPageLoadDeferrer::dispose()
74 {
75 detach();
76 m_deferredFrames.clear();
77 }
78 #endif
79
80 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer() 68 ScopedPageLoadDeferrer::~ScopedPageLoadDeferrer()
81 { 69 {
82 detach(); 70 detach();
83 } 71 }
84 72
85 DEFINE_TRACE(ScopedPageLoadDeferrer)
86 {
87 #if ENABLE(OILPAN)
88 visitor->trace(m_deferredFrames);
89 #endif
90 }
91
92 } // namespace blink 73 } // namespace blink
OLDNEW
« 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