OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |