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

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

Issue 901663005: Revert r189385 "Remove LifecycleContext" and r189391, r189530, r189456 that block it (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/page/PageLifecycleNotifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/layout/Layer.h" 43 #include "core/layout/Layer.h"
44 #include "core/loader/FrameLoader.h" 44 #include "core/loader/FrameLoader.h"
45 #include "core/loader/HistoryItem.h" 45 #include "core/loader/HistoryItem.h"
46 #include "core/page/AutoscrollController.h" 46 #include "core/page/AutoscrollController.h"
47 #include "core/page/Chrome.h" 47 #include "core/page/Chrome.h"
48 #include "core/page/ChromeClient.h" 48 #include "core/page/ChromeClient.h"
49 #include "core/page/ContextMenuController.h" 49 #include "core/page/ContextMenuController.h"
50 #include "core/page/DragController.h" 50 #include "core/page/DragController.h"
51 #include "core/page/FocusController.h" 51 #include "core/page/FocusController.h"
52 #include "core/page/FrameTree.h" 52 #include "core/page/FrameTree.h"
53 #include "core/page/PageLifecycleNotifier.h"
53 #include "core/page/PointerLockController.h" 54 #include "core/page/PointerLockController.h"
54 #include "core/page/ValidationMessageClient.h" 55 #include "core/page/ValidationMessageClient.h"
55 #include "core/page/scrolling/ScrollingCoordinator.h" 56 #include "core/page/scrolling/ScrollingCoordinator.h"
56 #include "core/rendering/RenderView.h" 57 #include "core/rendering/RenderView.h"
57 #include "core/rendering/TextAutosizer.h" 58 #include "core/rendering/TextAutosizer.h"
58 #include "platform/graphics/GraphicsLayer.h" 59 #include "platform/graphics/GraphicsLayer.h"
59 #include "platform/plugins/PluginData.h" 60 #include "platform/plugins/PluginData.h"
60 #include "wtf/HashMap.h" 61 #include "wtf/HashMap.h"
61 #include "wtf/RefCountedLeakCounter.h" 62 #include "wtf/RefCountedLeakCounter.h"
62 #include "wtf/StdLibExtras.h" 63 #include "wtf/StdLibExtras.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 { 106 {
106 if (!frame) 107 if (!frame)
107 return 1; 108 return 1;
108 Page* page = frame->page(); 109 Page* page = frame->page();
109 if (!page) 110 if (!page)
110 return 1; 111 return 1;
111 return page->deviceScaleFactor(); 112 return page->deviceScaleFactor();
112 } 113 }
113 114
114 Page::Page(PageClients& pageClients) 115 Page::Page(PageClients& pageClients)
115 : PageLifecycleNotifier(this) 116 : SettingsDelegate(Settings::create())
116 , SettingsDelegate(Settings::create())
117 , m_animator(PageAnimator::create(*this)) 117 , m_animator(PageAnimator::create(*this))
118 , m_autoscrollController(AutoscrollController::create(*this)) 118 , m_autoscrollController(AutoscrollController::create(*this))
119 , m_chrome(Chrome::create(this, pageClients.chromeClient)) 119 , m_chrome(Chrome::create(this, pageClients.chromeClient))
120 , m_dragCaretController(DragCaretController::create()) 120 , m_dragCaretController(DragCaretController::create())
121 , m_dragController(DragController::create(this, pageClients.dragClient)) 121 , m_dragController(DragController::create(this, pageClients.dragClient))
122 , m_focusController(FocusController::create(this)) 122 , m_focusController(FocusController::create(this))
123 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient)) 123 , m_contextMenuController(ContextMenuController::create(this, pageClients.co ntextMenuClient))
124 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient)) 124 , m_inspectorController(InspectorController::create(this, pageClients.inspec torClient))
125 , m_pointerLockController(PointerLockController::create(this)) 125 , m_pointerLockController(PointerLockController::create(this))
126 , m_undoStack(UndoStack::create()) 126 , m_undoStack(UndoStack::create())
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (m_visibilityState == visibilityState) 420 if (m_visibilityState == visibilityState)
421 return; 421 return;
422 m_visibilityState = visibilityState; 422 m_visibilityState = visibilityState;
423 423
424 if (visibilityState == blink::PageVisibilityStateVisible) 424 if (visibilityState == blink::PageVisibilityStateVisible)
425 setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()); 425 setTimerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval());
426 else 426 else
427 setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval()); 427 setTimerAlignmentInterval(DOMTimer::hiddenPageAlignmentInterval());
428 428
429 if (!isInitialState) 429 if (!isInitialState)
430 notifyPageVisibilityChanged(); 430 lifecycleNotifier().notifyPageVisibilityChanged();
431 431
432 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame()) 432 if (!isInitialState && m_mainFrame && m_mainFrame->isLocalFrame())
433 deprecatedLocalMainFrame()->didChangeVisibilityState(); 433 deprecatedLocalMainFrame()->didChangeVisibilityState();
434 } 434 }
435 435
436 PageVisibilityState Page::visibilityState() const 436 PageVisibilityState Page::visibilityState() const
437 { 437 {
438 return m_visibilityState; 438 return m_visibilityState;
439 } 439 }
440 440
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 526 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
527 if (!frame->isLocalFrame()) 527 if (!frame->isLocalFrame())
528 continue; 528 continue;
529 if (FrameView* view = toLocalFrame(frame)->view()) 529 if (FrameView* view = toLocalFrame(frame)->view())
530 view->updateAcceleratedCompositingSettings(); 530 view->updateAcceleratedCompositingSettings();
531 } 531 }
532 } 532 }
533 533
534 void Page::didCommitLoad(LocalFrame* frame) 534 void Page::didCommitLoad(LocalFrame* frame)
535 { 535 {
536 notifyDidCommitLoad(frame); 536 lifecycleNotifier().notifyDidCommitLoad(frame);
537 if (m_mainFrame == frame) { 537 if (m_mainFrame == frame) {
538 frame->console().clearMessages(); 538 frame->console().clearMessages();
539 useCounter().didCommitLoad(); 539 useCounter().didCommitLoad();
540 m_inspectorController->didCommitLoadForMainFrame(); 540 m_inspectorController->didCommitLoadForMainFrame();
541 UserGestureIndicator::clearProcessedUserGestureSinceLoad(); 541 UserGestureIndicator::clearProcessedUserGestureSinceLoad();
542 } 542 }
543 } 543 }
544 544
545 void Page::acceptLanguagesChanged() 545 void Page::acceptLanguagesChanged()
546 { 546 {
547 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> frames; 547 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> frames;
548 548
549 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire 549 // Even though we don't fire an event from here, the LocalDOMWindow's will f ire
550 // an event so we keep the frames alive until we are done. 550 // an event so we keep the frames alive until we are done.
551 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) { 551 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
552 if (frame->isLocalFrame()) 552 if (frame->isLocalFrame())
553 frames.append(toLocalFrame(frame)); 553 frames.append(toLocalFrame(frame));
554 } 554 }
555 555
556 for (unsigned i = 0; i < frames.size(); ++i) 556 for (unsigned i = 0; i < frames.size(); ++i)
557 frames[i]->localDOMWindow()->acceptLanguagesChanged(); 557 frames[i]->localDOMWindow()->acceptLanguagesChanged();
558 } 558 }
559 559
560 PageLifecycleNotifier& Page::lifecycleNotifier()
561 {
562 return static_cast<PageLifecycleNotifier&>(LifecycleContext<Page>::lifecycle Notifier());
563 }
564
565 PassOwnPtr<LifecycleNotifier<Page>> Page::createLifecycleNotifier()
566 {
567 return PageLifecycleNotifier::create(this);
568 }
569
560 void Page::trace(Visitor* visitor) 570 void Page::trace(Visitor* visitor)
561 { 571 {
562 #if ENABLE(OILPAN) 572 #if ENABLE(OILPAN)
563 visitor->trace(m_animator); 573 visitor->trace(m_animator);
564 visitor->trace(m_dragCaretController); 574 visitor->trace(m_dragCaretController);
565 visitor->trace(m_dragController); 575 visitor->trace(m_dragController);
566 visitor->trace(m_focusController); 576 visitor->trace(m_focusController);
567 visitor->trace(m_contextMenuController); 577 visitor->trace(m_contextMenuController);
568 visitor->trace(m_inspectorController); 578 visitor->trace(m_inspectorController);
569 visitor->trace(m_pointerLockController); 579 visitor->trace(m_pointerLockController);
570 visitor->trace(m_undoStack); 580 visitor->trace(m_undoStack);
571 visitor->trace(m_mainFrame); 581 visitor->trace(m_mainFrame);
572 visitor->trace(m_validationMessageClient); 582 visitor->trace(m_validationMessageClient);
573 visitor->trace(m_multisamplingChangedObservers); 583 visitor->trace(m_multisamplingChangedObservers);
574 visitor->trace(m_frameHost); 584 visitor->trace(m_frameHost);
575 HeapSupplementable<Page>::trace(visitor); 585 HeapSupplementable<Page>::trace(visitor);
576 #endif 586 #endif
577 PageLifecycleNotifier::trace(visitor); 587 LifecycleContext<Page>::trace(visitor);
578 } 588 }
579 589
580 void Page::willBeDestroyed() 590 void Page::willBeDestroyed()
581 { 591 {
582 // Destroy inspector first, since it uses frame and view during destruction. 592 // Destroy inspector first, since it uses frame and view during destruction.
583 m_inspectorController->willBeDestroyed(); 593 m_inspectorController->willBeDestroyed();
584 594
585 RefPtrWillBeRawPtr<Frame> mainFrame = m_mainFrame; 595 RefPtrWillBeRawPtr<Frame> mainFrame = m_mainFrame;
586 596
587 mainFrame->detach(); 597 mainFrame->detach();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 , inspectorClient(nullptr) 630 , inspectorClient(nullptr)
621 , spellCheckerClient(nullptr) 631 , spellCheckerClient(nullptr)
622 { 632 {
623 } 633 }
624 634
625 Page::PageClients::~PageClients() 635 Page::PageClients::~PageClients()
626 { 636 {
627 } 637 }
628 638
629 } // namespace blink 639 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/page/PageLifecycleNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698