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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back out non-Oilpan experiment + tidy up by adding frame() ref accessors Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved.
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
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 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // static 76 // static
77 HashSet<Page*>& Page::ordinaryPages() 77 HashSet<Page*>& Page::ordinaryPages()
78 { 78 {
79 DEFINE_STATIC_LOCAL(HashSet<Page*>, ordinaryPages, ()); 79 DEFINE_STATIC_LOCAL(HashSet<Page*>, ordinaryPages, ());
80 return ordinaryPages; 80 return ordinaryPages;
81 } 81 }
82 82
83 83
84 void Page::networkStateChanged(bool online) 84 void Page::networkStateChanged(bool online)
85 { 85 {
86 Vector<RefPtr<LocalFrame> > frames; 86 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > frames;
87 87
88 // Get all the frames of all the pages in all the page groups 88 // Get all the frames of all the pages in all the page groups
89 HashSet<Page*>::iterator end = allPages().end(); 89 HashSet<Page*>::iterator end = allPages().end();
90 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) { 90 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) {
91 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().tra verseNext()) { 91 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().tra verseNext()) {
92 // FIXME: There is currently no way to dispatch events to out-of-pro cess frames. 92 // FIXME: There is currently no way to dispatch events to out-of-pro cess frames.
93 if (frame->isLocalFrame()) 93 if (frame->isLocalFrame())
94 frames.append(toLocalFrame(frame)); 94 frames.append(toLocalFrame(frame));
95 } 95 }
96 InspectorInstrumentation::networkStateChanged(*it, online); 96 InspectorInstrumentation::networkStateChanged(*it, online);
(...skipping 19 matching lines...) Expand all
116 , m_animator(this) 116 , m_animator(this)
117 , m_autoscrollController(AutoscrollController::create(*this)) 117 , m_autoscrollController(AutoscrollController::create(*this))
118 , m_chrome(Chrome::create(this, pageClients.chromeClient)) 118 , m_chrome(Chrome::create(this, pageClients.chromeClient))
119 , m_dragCaretController(DragCaretController::create()) 119 , m_dragCaretController(DragCaretController::create())
120 , m_dragController(DragController::create(this, pageClients.dragClient)) 120 , m_dragController(DragController::create(this, pageClients.dragClient))
121 , m_focusController(FocusController::create(this)) 121 , m_focusController(FocusController::create(this))
122 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient)) 122 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient))
123 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient)) 123 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient))
124 , m_pointerLockController(PointerLockController::create(this)) 124 , m_pointerLockController(PointerLockController::create(this))
125 , m_undoStack(UndoStack::create()) 125 , m_undoStack(UndoStack::create())
126 , m_mainFrame(0) 126 , m_mainFrame(nullptr)
127 , m_backForwardClient(pageClients.backForwardClient) 127 , m_backForwardClient(pageClients.backForwardClient)
128 , m_editorClient(pageClients.editorClient) 128 , m_editorClient(pageClients.editorClient)
129 , m_spellCheckerClient(pageClients.spellCheckerClient) 129 , m_spellCheckerClient(pageClients.spellCheckerClient)
130 , m_storageClient(pageClients.storageClient) 130 , m_storageClient(pageClients.storageClient)
131 , m_subframeCount(0) 131 , m_subframeCount(0)
132 , m_openedByDOM(false) 132 , m_openedByDOM(false)
133 , m_tabKeyCyclesThroughElements(true) 133 , m_tabKeyCyclesThroughElements(true)
134 , m_defersLoading(false) 134 , m_defersLoading(false)
135 , m_deviceScaleFactor(1) 135 , m_deviceScaleFactor(1)
136 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()) 136 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 } 259 }
260 260
261 void Page::refreshPlugins(bool reload) 261 void Page::refreshPlugins(bool reload)
262 { 262 {
263 if (allPages().isEmpty()) 263 if (allPages().isEmpty())
264 return; 264 return;
265 265
266 PluginData::refresh(); 266 PluginData::refresh();
267 267
268 Vector<RefPtr<LocalFrame> > framesNeedingReload; 268 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > framesNeedingReload;
269 269
270 HashSet<Page*>::iterator end = allPages().end(); 270 HashSet<Page*>::iterator end = allPages().end();
271 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) { 271 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) {
272 Page* page = *it; 272 Page* page = *it;
273 273
274 // Clear out the page's plug-in data. 274 // Clear out the page's plug-in data.
275 if (page->m_pluginData) 275 if (page->m_pluginData)
276 page->m_pluginData = nullptr; 276 page->m_pluginData = nullptr;
277 277
278 if (!reload) 278 if (!reload)
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 if (m_mainFrame == frame) { 572 if (m_mainFrame == frame) {
573 frame->console().clearMessages(); 573 frame->console().clearMessages();
574 useCounter().didCommitLoad(); 574 useCounter().didCommitLoad();
575 m_inspectorController->didCommitLoadForMainFrame(); 575 m_inspectorController->didCommitLoadForMainFrame();
576 UserGestureIndicator::clearProcessedUserGestureSinceLoad(); 576 UserGestureIndicator::clearProcessedUserGestureSinceLoad();
577 } 577 }
578 } 578 }
579 579
580 void Page::acceptLanguagesChanged() 580 void Page::acceptLanguagesChanged()
581 { 581 {
582 Vector< RefPtr<LocalFrame> > frames; 582 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > frames;
583 583
584 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire 584 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire
585 // an event so we keep the frames alive until we are done. 585 // an event so we keep the frames alive until we are done.
586 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 586 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
587 if (frame->isLocalFrame()) 587 if (frame->isLocalFrame())
588 frames.append(toLocalFrame(frame)); 588 frames.append(toLocalFrame(frame));
589 } 589 }
590 590
591 for (unsigned i = 0; i < frames.size(); ++i) 591 for (unsigned i = 0; i < frames.size(); ++i)
592 frames[i]->domWindow()->acceptLanguagesChanged(); 592 frames[i]->domWindow()->acceptLanguagesChanged();
593 } 593 }
594 594
595 PageLifecycleNotifier& Page::lifecycleNotifier() 595 PageLifecycleNotifier& Page::lifecycleNotifier()
596 { 596 {
597 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier()); 597 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier());
598 } 598 }
599 599
600 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier() 600 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier()
601 { 601 {
602 return PageLifecycleNotifier::create(this); 602 return PageLifecycleNotifier::create(this);
603 } 603 }
604 604
605 void Page::trace(Visitor* visitor) 605 void Page::trace(Visitor* visitor)
606 { 606 {
607 #if ENABLE(OILPAN) 607 #if ENABLE(OILPAN)
608 visitor->trace(m_dragCaretController); 608 visitor->trace(m_dragCaretController);
609 visitor->trace(m_dragController); 609 visitor->trace(m_dragController);
610 visitor->trace(m_focusController);
610 visitor->trace(m_contextMenuController); 611 visitor->trace(m_contextMenuController);
611 visitor->trace(m_inspectorController); 612 visitor->trace(m_inspectorController);
612 visitor->trace(m_pointerLockController); 613 visitor->trace(m_pointerLockController);
613 visitor->trace(m_undoStack); 614 visitor->trace(m_undoStack);
615 visitor->trace(m_mainFrame);
614 visitor->trace(m_validationMessageClient); 616 visitor->trace(m_validationMessageClient);
615 visitor->trace(m_multisamplingChangedObservers); 617 visitor->trace(m_multisamplingChangedObservers);
616 visitor->trace(m_frameHost); 618 visitor->trace(m_frameHost);
617 #endif 619 #endif
618 WillBeHeapSupplementable<Page>::trace(visitor); 620 WillBeHeapSupplementable<Page>::trace(visitor);
619 LifecycleContext<Page>::trace(visitor); 621 LifecycleContext<Page>::trace(visitor);
620 } 622 }
621 623
622 void Page::willBeDestroyed() 624 void Page::willBeDestroyed()
623 { 625 {
624 // Destroy inspector first, since it uses frame and view during destruction. 626 // Destroy inspector first, since it uses frame and view during destruction.
625 m_inspectorController->willBeDestroyed(); 627 m_inspectorController->willBeDestroyed();
626 628
627 RefPtr<Frame> mainFrame = m_mainFrame; 629 RefPtrWillBeRawPtr<Frame> mainFrame = m_mainFrame;
628 630
629 mainFrame->detach(); 631 mainFrame->detach();
630 632
631 if (mainFrame->isLocalFrame()) { 633 if (mainFrame->isLocalFrame()) {
632 toLocalFrame(mainFrame.get())->setView(nullptr); 634 toLocalFrame(mainFrame.get())->setView(nullptr);
633 } else { 635 } else {
634 ASSERT(m_mainFrame->isRemoteFrame()); 636 ASSERT(m_mainFrame->isRemoteFrame());
635 toRemoteFrame(mainFrame.get())->setView(nullptr); 637 toRemoteFrame(mainFrame.get())->setView(nullptr);
636 } 638 }
637 639
638 allPages().remove(this); 640 allPages().remove(this);
639 if (ordinaryPages().contains(this)) 641 if (ordinaryPages().contains(this))
640 ordinaryPages().remove(this); 642 ordinaryPages().remove(this);
641 643
642 if (m_scrollingCoordinator) 644 if (m_scrollingCoordinator)
643 m_scrollingCoordinator->willBeDestroyed(); 645 m_scrollingCoordinator->willBeDestroyed();
644 646
645 #ifndef NDEBUG 647 #ifndef NDEBUG
646 pageCounter.decrement(); 648 pageCounter.decrement();
647 #endif 649 #endif
648 650
649 m_chrome->willBeDestroyed(); 651 m_chrome->willBeDestroyed();
650 m_mainFrame = 0;
651 if (m_validationMessageClient) 652 if (m_validationMessageClient)
652 m_validationMessageClient->willBeDestroyed(); 653 m_validationMessageClient->willBeDestroyed();
654 m_mainFrame = nullptr;
653 } 655 }
654 656
655 Page::PageClients::PageClients() 657 Page::PageClients::PageClients()
656 : chromeClient(0) 658 : chromeClient(0)
657 , contextMenuClient(0) 659 , contextMenuClient(0)
658 , editorClient(0) 660 , editorClient(0)
659 , dragClient(0) 661 , dragClient(0)
660 , inspectorClient(0) 662 , inspectorClient(0)
661 , backForwardClient(0) 663 , backForwardClient(0)
662 , spellCheckerClient(0) 664 , spellCheckerClient(0)
663 , storageClient(0) 665 , storageClient(0)
664 { 666 {
665 } 667 }
666 668
667 Page::PageClients::~PageClients() 669 Page::PageClients::~PageClients()
668 { 670 {
669 } 671 }
670 672
671 } // namespace blink 673 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698