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

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: Add LocalFrame::detachView() + more Oilpan frame finalization comments 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 161 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 lifecycleNotifier().notifyDidCommitLoad(frame); 571 lifecycleNotifier().notifyDidCommitLoad(frame);
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 } 576 }
577 } 577 }
578 578
579 void Page::acceptLanguagesChanged() 579 void Page::acceptLanguagesChanged()
580 { 580 {
581 Vector< RefPtr<LocalFrame> > frames; 581 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > frames;
582 582
583 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire 583 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire
584 // an event so we keep the frames alive until we are done. 584 // an event so we keep the frames alive until we are done.
585 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 585 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
586 if (frame->isLocalFrame()) 586 if (frame->isLocalFrame())
587 frames.append(toLocalFrame(frame)); 587 frames.append(toLocalFrame(frame));
588 } 588 }
589 589
590 for (unsigned i = 0; i < frames.size(); ++i) 590 for (unsigned i = 0; i < frames.size(); ++i)
591 frames[i]->domWindow()->acceptLanguagesChanged(); 591 frames[i]->domWindow()->acceptLanguagesChanged();
592 } 592 }
593 593
594 PageLifecycleNotifier& Page::lifecycleNotifier() 594 PageLifecycleNotifier& Page::lifecycleNotifier()
595 { 595 {
596 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier()); 596 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier());
597 } 597 }
598 598
599 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier() 599 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier()
600 { 600 {
601 return PageLifecycleNotifier::create(this); 601 return PageLifecycleNotifier::create(this);
602 } 602 }
603 603
604 void Page::trace(Visitor* visitor) 604 void Page::trace(Visitor* visitor)
605 { 605 {
606 #if ENABLE(OILPAN) 606 #if ENABLE(OILPAN)
607 visitor->trace(m_dragCaretController); 607 visitor->trace(m_dragCaretController);
608 visitor->trace(m_dragController); 608 visitor->trace(m_dragController);
609 visitor->trace(m_focusController);
609 visitor->trace(m_contextMenuController); 610 visitor->trace(m_contextMenuController);
610 visitor->trace(m_inspectorController); 611 visitor->trace(m_inspectorController);
611 visitor->trace(m_pointerLockController); 612 visitor->trace(m_pointerLockController);
612 visitor->trace(m_undoStack); 613 visitor->trace(m_undoStack);
613 visitor->trace(m_validationMessageClient); 614 visitor->trace(m_validationMessageClient);
614 visitor->trace(m_multisamplingChangedObservers); 615 visitor->trace(m_multisamplingChangedObservers);
615 visitor->trace(m_frameHost); 616 visitor->trace(m_frameHost);
616 #endif 617 #endif
617 WillBeHeapSupplementable<Page>::trace(visitor); 618 WillBeHeapSupplementable<Page>::trace(visitor);
618 LifecycleContext<Page>::trace(visitor); 619 LifecycleContext<Page>::trace(visitor);
619 } 620 }
620 621
621 void Page::willBeDestroyed() 622 void Page::willBeDestroyed()
622 { 623 {
623 // Destroy inspector first, since it uses frame and view during destruction. 624 // Destroy inspector first, since it uses frame and view during destruction.
624 m_inspectorController->willBeDestroyed(); 625 m_inspectorController->willBeDestroyed();
625 626
626 RefPtr<Frame> mainFrame = m_mainFrame; 627 RefPtrWillBeRawPtr<Frame> mainFrame = m_mainFrame;
627 628
628 mainFrame->detach(); 629 mainFrame->detach();
629 630
630 if (mainFrame->isLocalFrame()) { 631 if (mainFrame->isLocalFrame()) {
631 toLocalFrame(mainFrame.get())->setView(nullptr); 632 toLocalFrame(mainFrame.get())->setView(nullptr);
632 } else { 633 } else {
633 ASSERT(m_mainFrame->isRemoteFrame()); 634 ASSERT(m_mainFrame->isRemoteFrame());
634 toRemoteFrame(mainFrame.get())->setView(nullptr); 635 toRemoteFrame(mainFrame.get())->setView(nullptr);
635 } 636 }
636 637
637 allPages().remove(this); 638 allPages().remove(this);
638 if (ordinaryPages().contains(this)) 639 if (ordinaryPages().contains(this))
639 ordinaryPages().remove(this); 640 ordinaryPages().remove(this);
640 641
641 if (m_scrollingCoordinator) 642 if (m_scrollingCoordinator)
642 m_scrollingCoordinator->willBeDestroyed(); 643 m_scrollingCoordinator->willBeDestroyed();
643 644
644 #ifndef NDEBUG 645 #ifndef NDEBUG
645 pageCounter.decrement(); 646 pageCounter.decrement();
646 #endif 647 #endif
647 648
648 m_chrome->willBeDestroyed(); 649 m_chrome->willBeDestroyed();
649 m_mainFrame = 0;
650 if (m_validationMessageClient) 650 if (m_validationMessageClient)
651 m_validationMessageClient->willBeDestroyed(); 651 m_validationMessageClient->willBeDestroyed();
652 m_mainFrame = nullptr;
652 } 653 }
653 654
654 Page::PageClients::PageClients() 655 Page::PageClients::PageClients()
655 : chromeClient(0) 656 : chromeClient(0)
656 , contextMenuClient(0) 657 , contextMenuClient(0)
657 , editorClient(0) 658 , editorClient(0)
658 , dragClient(0) 659 , dragClient(0)
659 , inspectorClient(0) 660 , inspectorClient(0)
660 , backForwardClient(0) 661 , backForwardClient(0)
661 , spellCheckerClient(0) 662 , spellCheckerClient(0)
662 , storageClient(0) 663 , storageClient(0)
663 { 664 {
664 } 665 }
665 666
666 Page::PageClients::~PageClients() 667 Page::PageClients::~PageClients()
667 { 668 {
668 } 669 }
669 670
670 } // namespace blink 671 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698