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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameHost.cpp

Issue 2743523002: Move FrameHost::m_globalRootScrollerController to Page (Closed)
Patch Set: Created 3 years, 9 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 32
33 #include "core/frame/EventHandlerRegistry.h" 33 #include "core/frame/EventHandlerRegistry.h"
34 #include "core/frame/FrameView.h" 34 #include "core/frame/FrameView.h"
35 #include "core/frame/VisualViewport.h" 35 #include "core/frame/VisualViewport.h"
36 #include "core/inspector/ConsoleMessageStorage.h" 36 #include "core/inspector/ConsoleMessageStorage.h"
37 #include "core/page/Page.h" 37 #include "core/page/Page.h"
38 #include "core/page/scrolling/OverscrollController.h" 38 #include "core/page/scrolling/OverscrollController.h"
39 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
40 #include "public/platform/Platform.h" 39 #include "public/platform/Platform.h"
41 #include "public/platform/WebScheduler.h" 40 #include "public/platform/WebScheduler.h"
42 41
43 namespace blink { 42 namespace blink {
44 43
45 FrameHost* FrameHost::create(Page& page) { 44 FrameHost* FrameHost::create(Page& page) {
46 return new FrameHost(page); 45 return new FrameHost(page);
47 } 46 }
48 47
49 FrameHost::FrameHost(Page& page) 48 FrameHost::FrameHost(Page& page)
50 : m_page(&page), 49 : m_page(&page),
51 m_visualViewport(VisualViewport::create(*this)), 50 m_visualViewport(VisualViewport::create(*this)),
52 m_overscrollController( 51 m_overscrollController(
53 OverscrollController::create(*m_visualViewport, 52 OverscrollController::create(*m_visualViewport,
54 m_page->chromeClient())), 53 m_page->chromeClient())),
55 m_eventHandlerRegistry(new EventHandlerRegistry(page)), 54 m_eventHandlerRegistry(new EventHandlerRegistry(page)),
56 m_consoleMessageStorage(new ConsoleMessageStorage()), 55 m_consoleMessageStorage(new ConsoleMessageStorage()),
57 m_globalRootScrollerController(
58 TopDocumentRootScrollerController::create(page)),
59 m_subframeCount(0) {} 56 m_subframeCount(0) {}
60 57
61 // Explicitly in the .cpp to avoid default constructor in .h 58 // Explicitly in the .cpp to avoid default constructor in .h
62 FrameHost::~FrameHost() {} 59 FrameHost::~FrameHost() {}
63 60
64 Page& FrameHost::page() { 61 Page& FrameHost::page() {
65 return *m_page; 62 return *m_page;
66 } 63 }
67 64
68 const Page& FrameHost::page() const { 65 const Page& FrameHost::page() const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { 101 ConsoleMessageStorage& FrameHost::consoleMessageStorage() {
105 return *m_consoleMessageStorage; 102 return *m_consoleMessageStorage;
106 } 103 }
107 104
108 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { 105 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const {
109 return *m_consoleMessageStorage; 106 return *m_consoleMessageStorage;
110 } 107 }
111 108
112 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController() 109 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController()
113 const { 110 const {
114 return *m_globalRootScrollerController; 111 return page().globalRootScrollerController();
115 } 112 }
116 113
117 DEFINE_TRACE(FrameHost) { 114 DEFINE_TRACE(FrameHost) {
118 visitor->trace(m_page); 115 visitor->trace(m_page);
119 visitor->trace(m_visualViewport); 116 visitor->trace(m_visualViewport);
120 visitor->trace(m_overscrollController); 117 visitor->trace(m_overscrollController);
121 visitor->trace(m_eventHandlerRegistry); 118 visitor->trace(m_eventHandlerRegistry);
122 visitor->trace(m_consoleMessageStorage); 119 visitor->trace(m_consoleMessageStorage);
123 visitor->trace(m_globalRootScrollerController);
124 } 120 }
125 121
126 #if DCHECK_IS_ON() 122 #if DCHECK_IS_ON()
127 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { 123 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) {
128 ASSERT(expectedFrameCount >= 0); 124 ASSERT(expectedFrameCount >= 0);
129 125
130 int actualFrameCount = 0; 126 int actualFrameCount = 0;
131 for (; frame; frame = frame->tree().traverseNext()) 127 for (; frame; frame = frame->tree().traverseNext())
132 ++actualFrameCount; 128 ++actualFrameCount;
133 129
134 ASSERT(expectedFrameCount == actualFrameCount); 130 ASSERT(expectedFrameCount == actualFrameCount);
135 } 131 }
136 #endif 132 #endif
137 133
138 int FrameHost::subframeCount() const { 134 int FrameHost::subframeCount() const {
139 #if DCHECK_IS_ON() 135 #if DCHECK_IS_ON()
140 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); 136 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame());
141 #endif 137 #endif
142 return m_subframeCount; 138 return m_subframeCount;
143 } 139 }
144 140
145 } // namespace blink 141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698