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

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

Issue 2250883003: Use copyToVector in ScopedPageLoadDeferrer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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 22 matching lines...) Expand all
33 33
34 namespace { 34 namespace {
35 35
36 unsigned s_deferralCount = 0; 36 unsigned s_deferralCount = 0;
37 37
38 void setDefersLoading(bool isDeferred) 38 void setDefersLoading(bool isDeferred)
39 { 39 {
40 // Make a copy of the collection. Undeferring loads can cause script to run, 40 // Make a copy of the collection. Undeferring loads can cause script to run,
41 // which would mutate ordinaryPages() in the middle of iteration. 41 // which would mutate ordinaryPages() in the middle of iteration.
42 HeapVector<Member<Page>> pages; 42 HeapVector<Member<Page>> pages;
43 for (const auto& page : Page::ordinaryPages()) 43 copyToVector(Page::ordinaryPages(), pages);
44 pages.append(page);
45 for (const auto& page : pages) 44 for (const auto& page : pages)
46 page->setDefersLoading(isDeferred); 45 page->setDefersLoading(isDeferred);
47 } 46 }
48 47
49 } // namespace 48 } // namespace
50 49
51 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer() 50 ScopedPageLoadDeferrer::ScopedPageLoadDeferrer()
52 { 51 {
53 if (++s_deferralCount > 1) 52 if (++s_deferralCount > 1)
54 return; 53 return;
(...skipping 10 matching lines...) Expand all
65 setDefersLoading(false); 64 setDefersLoading(false);
66 Platform::current()->currentThread()->scheduler()->resumeTimerQueue(); 65 Platform::current()->currentThread()->scheduler()->resumeTimerQueue();
67 } 66 }
68 67
69 bool ScopedPageLoadDeferrer::isActive() 68 bool ScopedPageLoadDeferrer::isActive()
70 { 69 {
71 return s_deferralCount > 0; 70 return s_deferralCount > 0;
72 } 71 }
73 72
74 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698