| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All |
| 3 * Rights Reserved. | 3 * Rights Reserved. |
| 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. | 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. |
| 5 * (http://www.torchmobile.com/) | 5 * (http://www.torchmobile.com/) |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "core/paint/PaintLayer.h" | 55 #include "core/paint/PaintLayer.h" |
| 56 #include "platform/graphics/GraphicsLayer.h" | 56 #include "platform/graphics/GraphicsLayer.h" |
| 57 #include "platform/plugins/PluginData.h" | 57 #include "platform/plugins/PluginData.h" |
| 58 #include "public/platform/Platform.h" | 58 #include "public/platform/Platform.h" |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 // Set of all live pages; includes internal Page objects that are | 62 // Set of all live pages; includes internal Page objects that are |
| 63 // not observable from scripts. | 63 // not observable from scripts. |
| 64 static Page::PageSet& allPages() { | 64 static Page::PageSet& allPages() { |
| 65 DEFINE_STATIC_LOCAL(Page::PageSet, allPages, ()); | 65 DEFINE_STATIC_LOCAL(Page::PageSet, pages, ()); |
| 66 return allPages; | 66 return pages; |
| 67 } | 67 } |
| 68 | 68 |
| 69 Page::PageSet& Page::ordinaryPages() { | 69 Page::PageSet& Page::ordinaryPages() { |
| 70 DEFINE_STATIC_LOCAL(Page::PageSet, ordinaryPages, ()); | 70 DEFINE_STATIC_LOCAL(Page::PageSet, pages, ()); |
| 71 return ordinaryPages; | 71 return pages; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void Page::networkStateChanged(bool online) { | 74 void Page::networkStateChanged(bool online) { |
| 75 HeapVector<Member<LocalFrame>> frames; | 75 HeapVector<Member<LocalFrame>> frames; |
| 76 | 76 |
| 77 // Get all the frames of all the pages in all the page groups | 77 // Get all the frames of all the pages in all the page groups |
| 78 for (Page* page : allPages()) { | 78 for (Page* page : allPages()) { |
| 79 for (Frame* frame = page->mainFrame(); frame; | 79 for (Frame* frame = page->mainFrame(); frame; |
| 80 frame = frame->tree().traverseNext()) { | 80 frame = frame->tree().traverseNext()) { |
| 81 // FIXME: There is currently no way to dispatch events to out-of-process | 81 // FIXME: There is currently no way to dispatch events to out-of-process |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 ASSERT(!allPages().contains(this)); | 143 ASSERT(!allPages().contains(this)); |
| 144 allPages().add(this); | 144 allPages().add(this); |
| 145 } | 145 } |
| 146 | 146 |
| 147 Page::~Page() { | 147 Page::~Page() { |
| 148 // willBeDestroyed() must be called before Page destruction. | 148 // willBeDestroyed() must be called before Page destruction. |
| 149 ASSERT(!m_mainFrame); | 149 ASSERT(!m_mainFrame); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void Page::closeSoon() { |
| 153 // Make sure this Page can no longer be found by JS. |
| 154 m_isClosing = true; |
| 155 |
| 156 // TODO(dcheng): Try to remove this in a followup, it's not obviously needed. |
| 157 if (m_mainFrame->isLocalFrame()) |
| 158 toLocalFrame(m_mainFrame)->loader().stopAllLoaders(); |
| 159 |
| 160 chromeClient().closeWindowSoon(); |
| 161 } |
| 162 |
| 152 ViewportDescription Page::viewportDescription() const { | 163 ViewportDescription Page::viewportDescription() const { |
| 153 return mainFrame() && mainFrame()->isLocalFrame() && | 164 return mainFrame() && mainFrame()->isLocalFrame() && |
| 154 deprecatedLocalMainFrame()->document() | 165 deprecatedLocalMainFrame()->document() |
| 155 ? deprecatedLocalMainFrame()->document()->viewportDescription() | 166 ? deprecatedLocalMainFrame()->document()->viewportDescription() |
| 156 : ViewportDescription(); | 167 : ViewportDescription(); |
| 157 } | 168 } |
| 158 | 169 |
| 159 ScrollingCoordinator* Page::scrollingCoordinator() { | 170 ScrollingCoordinator* Page::scrollingCoordinator() { |
| 160 if (!m_scrollingCoordinator && m_settings->acceleratedCompositingEnabled()) | 171 if (!m_scrollingCoordinator && m_settings->acceleratedCompositingEnabled()) |
| 161 m_scrollingCoordinator = ScrollingCoordinator::create(this); | 172 m_scrollingCoordinator = ScrollingCoordinator::create(this); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 void Page::layerTreeViewInitialized(WebLayerTreeView& layerTreeView) { | 511 void Page::layerTreeViewInitialized(WebLayerTreeView& layerTreeView) { |
| 501 if (scrollingCoordinator()) | 512 if (scrollingCoordinator()) |
| 502 scrollingCoordinator()->layerTreeViewInitialized(layerTreeView); | 513 scrollingCoordinator()->layerTreeViewInitialized(layerTreeView); |
| 503 } | 514 } |
| 504 | 515 |
| 505 void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) { | 516 void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) { |
| 506 if (m_scrollingCoordinator) | 517 if (m_scrollingCoordinator) |
| 507 m_scrollingCoordinator->willCloseLayerTreeView(layerTreeView); | 518 m_scrollingCoordinator->willCloseLayerTreeView(layerTreeView); |
| 508 } | 519 } |
| 509 | 520 |
| 510 void Page::willBeClosed() { | |
| 511 ordinaryPages().remove(this); | |
| 512 } | |
| 513 | |
| 514 void Page::willBeDestroyed() { | 521 void Page::willBeDestroyed() { |
| 515 Frame* mainFrame = m_mainFrame; | 522 Frame* mainFrame = m_mainFrame; |
| 516 | 523 |
| 517 mainFrame->detach(FrameDetachType::Remove); | 524 mainFrame->detach(FrameDetachType::Remove); |
| 518 | 525 |
| 519 ASSERT(allPages().contains(this)); | 526 ASSERT(allPages().contains(this)); |
| 520 allPages().remove(this); | 527 allPages().remove(this); |
| 521 ordinaryPages().remove(this); | 528 ordinaryPages().remove(this); |
| 522 | 529 |
| 523 if (m_scrollingCoordinator) | 530 if (m_scrollingCoordinator) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 535 : chromeClient(nullptr), | 542 : chromeClient(nullptr), |
| 536 contextMenuClient(nullptr), | 543 contextMenuClient(nullptr), |
| 537 editorClient(nullptr), | 544 editorClient(nullptr), |
| 538 spellCheckerClient(nullptr) {} | 545 spellCheckerClient(nullptr) {} |
| 539 | 546 |
| 540 Page::PageClients::~PageClients() {} | 547 Page::PageClients::~PageClients() {} |
| 541 | 548 |
| 542 template class CORE_TEMPLATE_EXPORT Supplement<Page>; | 549 template class CORE_TEMPLATE_EXPORT Supplement<Page>; |
| 543 | 550 |
| 544 } // namespace blink | 551 } // namespace blink |
| OLD | NEW |