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

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

Issue 2575923002: Make sure pages that are closing but not yet closed are still suspended (non-preferred approach). (Closed)
Patch Set: . Created 4 years 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
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "platform/WebFrameScheduler.h" 56 #include "platform/WebFrameScheduler.h"
57 #include "platform/graphics/GraphicsLayer.h" 57 #include "platform/graphics/GraphicsLayer.h"
58 #include "platform/plugins/PluginData.h" 58 #include "platform/plugins/PluginData.h"
59 #include "public/platform/Platform.h" 59 #include "public/platform/Platform.h"
60 60
61 namespace blink { 61 namespace blink {
62 62
63 // Set of all live pages; includes internal Page objects that are 63 // Set of all live pages; includes internal Page objects that are
64 // not observable from scripts. 64 // not observable from scripts.
65 static Page::PageSet& allPages() { 65 static Page::PageSet& allPages() {
66 DEFINE_STATIC_LOCAL(Page::PageSet, allPages, ()); 66 DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
67 return allPages; 67 return pages;
68 } 68 }
69 69
70 Page::PageSet& Page::ordinaryPages() { 70 Page::PageSet& Page::ordinaryPages() {
71 DEFINE_STATIC_LOCAL(Page::PageSet, ordinaryPages, ()); 71 DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
72 return ordinaryPages; 72 return pages;
73 }
74
75 Page::PageSet& Page::willBeClosedOrdinaryPages() {
76 DEFINE_STATIC_LOCAL(Page::PageSet, pages, ());
77 return pages;
73 } 78 }
74 79
75 void Page::networkStateChanged(bool online) { 80 void Page::networkStateChanged(bool online) {
76 HeapVector<Member<LocalFrame>> frames; 81 HeapVector<Member<LocalFrame>> frames;
77 82
78 // Get all the frames of all the pages in all the page groups 83 // Get all the frames of all the pages in all the page groups
79 for (Page* page : allPages()) { 84 for (Page* page : allPages()) {
80 for (Frame* frame = page->mainFrame(); frame; 85 for (Frame* frame = page->mainFrame(); frame;
81 frame = frame->tree().traverseNext()) { 86 frame = frame->tree().traverseNext()) {
82 // FIXME: There is currently no way to dispatch events to out-of-process 87 // FIXME: There is currently no way to dispatch events to out-of-process
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (scrollingCoordinator()) 510 if (scrollingCoordinator())
506 scrollingCoordinator()->layerTreeViewInitialized(layerTreeView); 511 scrollingCoordinator()->layerTreeViewInitialized(layerTreeView);
507 } 512 }
508 513
509 void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) { 514 void Page::willCloseLayerTreeView(WebLayerTreeView& layerTreeView) {
510 if (m_scrollingCoordinator) 515 if (m_scrollingCoordinator)
511 m_scrollingCoordinator->willCloseLayerTreeView(layerTreeView); 516 m_scrollingCoordinator->willCloseLayerTreeView(layerTreeView);
512 } 517 }
513 518
514 void Page::willBeClosed() { 519 void Page::willBeClosed() {
520 DCHECK(!ScopedPageSuspender::isActive());
515 ordinaryPages().remove(this); 521 ordinaryPages().remove(this);
522 willBeClosedOrdinaryPages().add(this);
516 } 523 }
517 524
518 void Page::willBeDestroyed() { 525 void Page::willBeDestroyed() {
526 DCHECK(!ScopedPageSuspender::isActive());
519 Frame* mainFrame = m_mainFrame; 527 Frame* mainFrame = m_mainFrame;
520 528
521 mainFrame->detach(FrameDetachType::Remove); 529 mainFrame->detach(FrameDetachType::Remove);
522 530
523 ASSERT(allPages().contains(this)); 531 ASSERT(allPages().contains(this));
524 allPages().remove(this); 532 allPages().remove(this);
525 ordinaryPages().remove(this); 533 ordinaryPages().remove(this);
534 willBeClosedOrdinaryPages().remove(this);
526 535
527 if (m_scrollingCoordinator) 536 if (m_scrollingCoordinator)
528 m_scrollingCoordinator->willBeDestroyed(); 537 m_scrollingCoordinator->willBeDestroyed();
529 538
530 chromeClient().chromeDestroyed(); 539 chromeClient().chromeDestroyed();
531 if (m_validationMessageClient) 540 if (m_validationMessageClient)
532 m_validationMessageClient->willBeDestroyed(); 541 m_validationMessageClient->willBeDestroyed();
533 m_mainFrame = nullptr; 542 m_mainFrame = nullptr;
534 543
535 PageVisibilityNotifier::notifyContextDestroyed(); 544 PageVisibilityNotifier::notifyContextDestroyed();
536 } 545 }
537 546
538 Page::PageClients::PageClients() 547 Page::PageClients::PageClients()
539 : chromeClient(nullptr), 548 : chromeClient(nullptr),
540 contextMenuClient(nullptr), 549 contextMenuClient(nullptr),
541 editorClient(nullptr), 550 editorClient(nullptr),
542 spellCheckerClient(nullptr) {} 551 spellCheckerClient(nullptr) {}
543 552
544 Page::PageClients::~PageClients() {} 553 Page::PageClients::~PageClients() {}
545 554
546 template class CORE_TEMPLATE_EXPORT Supplement<Page>; 555 template class CORE_TEMPLATE_EXPORT Supplement<Page>;
547 556
548 } // namespace blink 557 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.h ('k') | third_party/WebKit/Source/core/page/ScopedPageSuspender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698