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

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: Rebase past r181245 conflict 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // static 75 // static
76 HashSet<Page*>& Page::ordinaryPages() 76 HashSet<Page*>& Page::ordinaryPages()
77 { 77 {
78 DEFINE_STATIC_LOCAL(HashSet<Page*>, ordinaryPages, ()); 78 DEFINE_STATIC_LOCAL(HashSet<Page*>, ordinaryPages, ());
79 return ordinaryPages; 79 return ordinaryPages;
80 } 80 }
81 81
82 82
83 void Page::networkStateChanged(bool online) 83 void Page::networkStateChanged(bool online)
84 { 84 {
85 Vector<RefPtr<LocalFrame> > frames; 85 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > frames;
86 86
87 // Get all the frames of all the pages in all the page groups 87 // Get all the frames of all the pages in all the page groups
88 HashSet<Page*>::iterator end = allPages().end(); 88 HashSet<Page*>::iterator end = allPages().end();
89 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) { 89 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) {
90 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().tra verseNext()) { 90 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree().tra verseNext()) {
91 // FIXME: There is currently no way to dispatch events to out-of-pro cess frames. 91 // FIXME: There is currently no way to dispatch events to out-of-pro cess frames.
92 if (frame->isLocalFrame()) 92 if (frame->isLocalFrame())
93 frames.append(toLocalFrame(frame)); 93 frames.append(toLocalFrame(frame));
94 } 94 }
95 InspectorInstrumentation::networkStateChanged(*it, online); 95 InspectorInstrumentation::networkStateChanged(*it, online);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 } 258 }
259 259
260 void Page::refreshPlugins(bool reload) 260 void Page::refreshPlugins(bool reload)
261 { 261 {
262 if (allPages().isEmpty()) 262 if (allPages().isEmpty())
263 return; 263 return;
264 264
265 PluginData::refresh(); 265 PluginData::refresh();
266 266
267 Vector<RefPtr<LocalFrame> > framesNeedingReload; 267 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > framesNeedingReload;
268 268
269 HashSet<Page*>::iterator end = allPages().end(); 269 HashSet<Page*>::iterator end = allPages().end();
270 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) { 270 for (HashSet<Page*>::iterator it = allPages().begin(); it != end; ++it) {
271 Page* page = *it; 271 Page* page = *it;
272 272
273 // Clear out the page's plug-in data. 273 // Clear out the page's plug-in data.
274 if (page->m_pluginData) 274 if (page->m_pluginData)
275 page->m_pluginData = nullptr; 275 page->m_pluginData = nullptr;
276 276
277 if (!reload) 277 if (!reload)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 { 559 {
560 lifecycleNotifier().notifyDidCommitLoad(frame); 560 lifecycleNotifier().notifyDidCommitLoad(frame);
561 if (m_mainFrame == frame) { 561 if (m_mainFrame == frame) {
562 useCounter().didCommitLoad(); 562 useCounter().didCommitLoad();
563 m_inspectorController->didCommitLoadForMainFrame(); 563 m_inspectorController->didCommitLoadForMainFrame();
564 } 564 }
565 } 565 }
566 566
567 void Page::acceptLanguagesChanged() 567 void Page::acceptLanguagesChanged()
568 { 568 {
569 Vector< RefPtr<LocalFrame> > frames; 569 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > frames;
570 570
571 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire 571 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire
572 // an event so we keep the frames alive until we are done. 572 // an event so we keep the frames alive until we are done.
573 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 573 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
574 if (frame->isLocalFrame()) 574 if (frame->isLocalFrame())
575 frames.append(toLocalFrame(frame)); 575 frames.append(toLocalFrame(frame));
576 } 576 }
577 577
578 for (unsigned i = 0; i < frames.size(); ++i) 578 for (unsigned i = 0; i < frames.size(); ++i)
579 frames[i]->domWindow()->acceptLanguagesChanged(); 579 frames[i]->domWindow()->acceptLanguagesChanged();
580 } 580 }
581 581
582 PageLifecycleNotifier& Page::lifecycleNotifier() 582 PageLifecycleNotifier& Page::lifecycleNotifier()
583 { 583 {
584 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier()); 584 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier());
585 } 585 }
586 586
587 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier() 587 PassOwnPtr<LifecycleNotifier<Page> > Page::createLifecycleNotifier()
588 { 588 {
589 return PageLifecycleNotifier::create(this); 589 return PageLifecycleNotifier::create(this);
590 } 590 }
591 591
592 void Page::trace(Visitor* visitor) 592 void Page::trace(Visitor* visitor)
593 { 593 {
594 #if ENABLE(OILPAN) 594 #if ENABLE(OILPAN)
595 visitor->trace(m_dragCaretController); 595 visitor->trace(m_dragCaretController);
596 visitor->trace(m_dragController); 596 visitor->trace(m_dragController);
597 visitor->trace(m_focusController);
597 visitor->trace(m_contextMenuController); 598 visitor->trace(m_contextMenuController);
598 visitor->trace(m_inspectorController); 599 visitor->trace(m_inspectorController);
599 visitor->trace(m_pointerLockController); 600 visitor->trace(m_pointerLockController);
600 visitor->trace(m_undoStack); 601 visitor->trace(m_undoStack);
601 visitor->trace(m_validationMessageClient); 602 visitor->trace(m_validationMessageClient);
602 visitor->trace(m_multisamplingChangedObservers); 603 visitor->trace(m_multisamplingChangedObservers);
603 visitor->trace(m_frameHost); 604 visitor->trace(m_frameHost);
604 #endif 605 #endif
605 WillBeHeapSupplementable<Page>::trace(visitor); 606 WillBeHeapSupplementable<Page>::trace(visitor);
606 LifecycleContext<Page>::trace(visitor); 607 LifecycleContext<Page>::trace(visitor);
607 } 608 }
608 609
609 void Page::willBeDestroyed() 610 void Page::willBeDestroyed()
610 { 611 {
611 RefPtr<Frame> mainFrame = m_mainFrame; 612 RefPtrWillBeRawPtr<Frame> mainFrame = m_mainFrame;
612 613
613 mainFrame->detach(); 614 mainFrame->detach();
614 615
615 // Disable all agents prior to resetting the frame view. 616 // Disable all agents prior to resetting the frame view.
616 m_inspectorController->willBeDestroyed(); 617 m_inspectorController->willBeDestroyed();
617 618
618 if (mainFrame->isLocalFrame()) { 619 if (mainFrame->isLocalFrame()) {
619 toLocalFrame(mainFrame.get())->setView(nullptr); 620 toLocalFrame(mainFrame.get())->setView(nullptr);
620 } else { 621 } else {
621 ASSERT(m_mainFrame->isRemoteFrame()); 622 ASSERT(m_mainFrame->isRemoteFrame());
622 toRemoteFrame(mainFrame.get())->setView(nullptr); 623 toRemoteFrame(mainFrame.get())->setView(nullptr);
623 } 624 }
624 625
625 allPages().remove(this); 626 allPages().remove(this);
626 if (ordinaryPages().contains(this)) 627 if (ordinaryPages().contains(this))
627 ordinaryPages().remove(this); 628 ordinaryPages().remove(this);
628 629
629 if (m_scrollingCoordinator) 630 if (m_scrollingCoordinator)
630 m_scrollingCoordinator->willBeDestroyed(); 631 m_scrollingCoordinator->willBeDestroyed();
631 632
632 #ifndef NDEBUG 633 #ifndef NDEBUG
633 pageCounter.decrement(); 634 pageCounter.decrement();
634 #endif 635 #endif
635 636
636 m_chrome->willBeDestroyed(); 637 m_chrome->willBeDestroyed();
637 m_mainFrame = 0;
638 if (m_validationMessageClient) 638 if (m_validationMessageClient)
639 m_validationMessageClient->willBeDestroyed(); 639 m_validationMessageClient->willBeDestroyed();
640 #if ENABLE(OILPAN)
641 if (mainFrame)
642 mainFrame->willBeDestroyed();
643 #endif
644 m_mainFrame = 0;
640 } 645 }
641 646
642 Page::PageClients::PageClients() 647 Page::PageClients::PageClients()
643 : chromeClient(0) 648 : chromeClient(0)
644 , contextMenuClient(0) 649 , contextMenuClient(0)
645 , editorClient(0) 650 , editorClient(0)
646 , dragClient(0) 651 , dragClient(0)
647 , inspectorClient(0) 652 , inspectorClient(0)
648 , backForwardClient(0) 653 , backForwardClient(0)
649 , spellCheckerClient(0) 654 , spellCheckerClient(0)
650 , storageClient(0) 655 , storageClient(0)
651 { 656 {
652 } 657 }
653 658
654 Page::PageClients::~PageClients() 659 Page::PageClients::~PageClients()
655 { 660 {
656 } 661 }
657 662
658 } // namespace blink 663 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698