2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #include "PageGroupLoadDeferrer.h"
24 #include "AsyncScriptRunner.h"
25 #include "DocumentParser.h"
28 #include "PageGroup.h"
29 #include <wtf/HashSet.h>
35 PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
37 const HashSet<Page*>& pages = page->group().pages();
39 HashSet<Page*>::const_iterator end = pages.end();
40 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {
41 Page* otherPage = *it;
42 if ((deferSelf || otherPage != page) && !otherPage->defersLoading())
43 m_deferredFrames.append(otherPage->mainFrame());
46 size_t count = m_deferredFrames.size();
47 for (size_t i = 0; i < count; ++i)
48 if (Page* page = m_deferredFrames[i]->page())
49 page->setDefersLoading(true);
52 PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
54 for (size_t i = 0; i < m_deferredFrames.size(); ++i) {
55 if (Page* page = m_deferredFrames[i]->page())
56 page->setDefersLoading(false);
61 } // namespace WebCore