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

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

Issue 2728423005: Move FrameHost::m_eventHandlerRegistry to Page (Closed)
Patch Set: Rebase 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "core/frame/FrameHost.h" 31 #include "core/frame/FrameHost.h"
32 32
33 #include "core/frame/EventHandlerRegistry.h"
34 #include "core/frame/FrameView.h" 33 #include "core/frame/FrameView.h"
35 #include "core/frame/VisualViewport.h" 34 #include "core/frame/VisualViewport.h"
36 #include "core/inspector/ConsoleMessageStorage.h" 35 #include "core/inspector/ConsoleMessageStorage.h"
37 #include "core/page/Page.h" 36 #include "core/page/Page.h"
38 #include "core/page/scrolling/OverscrollController.h" 37 #include "core/page/scrolling/OverscrollController.h"
39 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 38 #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)),
56 m_consoleMessageStorage(new ConsoleMessageStorage()), 54 m_consoleMessageStorage(new ConsoleMessageStorage()),
57 m_globalRootScrollerController( 55 m_globalRootScrollerController(
58 TopDocumentRootScrollerController::create(*this)), 56 TopDocumentRootScrollerController::create(*this)),
59 m_subframeCount(0) {} 57 m_subframeCount(0) {}
60 58
61 // Explicitly in the .cpp to avoid default constructor in .h 59 // Explicitly in the .cpp to avoid default constructor in .h
62 FrameHost::~FrameHost() {} 60 FrameHost::~FrameHost() {}
63 61
64 Page& FrameHost::page() { 62 Page& FrameHost::page() {
65 return *m_page; 63 return *m_page;
(...skipping 21 matching lines...) Expand all
87 85
88 VisualViewport& FrameHost::visualViewport() { 86 VisualViewport& FrameHost::visualViewport() {
89 return *m_visualViewport; 87 return *m_visualViewport;
90 } 88 }
91 89
92 const VisualViewport& FrameHost::visualViewport() const { 90 const VisualViewport& FrameHost::visualViewport() const {
93 return *m_visualViewport; 91 return *m_visualViewport;
94 } 92 }
95 93
96 EventHandlerRegistry& FrameHost::eventHandlerRegistry() { 94 EventHandlerRegistry& FrameHost::eventHandlerRegistry() {
97 return *m_eventHandlerRegistry; 95 return page().eventHandlerRegistry();
98 } 96 }
99 97
100 const EventHandlerRegistry& FrameHost::eventHandlerRegistry() const { 98 const EventHandlerRegistry& FrameHost::eventHandlerRegistry() const {
101 return *m_eventHandlerRegistry; 99 return page().eventHandlerRegistry();
102 } 100 }
103 101
104 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { 102 ConsoleMessageStorage& FrameHost::consoleMessageStorage() {
105 return *m_consoleMessageStorage; 103 return *m_consoleMessageStorage;
106 } 104 }
107 105
108 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { 106 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const {
109 return *m_consoleMessageStorage; 107 return *m_consoleMessageStorage;
110 } 108 }
111 109
112 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController() 110 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController()
113 const { 111 const {
114 return *m_globalRootScrollerController; 112 return *m_globalRootScrollerController;
115 } 113 }
116 114
117 DEFINE_TRACE(FrameHost) { 115 DEFINE_TRACE(FrameHost) {
118 visitor->trace(m_page); 116 visitor->trace(m_page);
119 visitor->trace(m_visualViewport); 117 visitor->trace(m_visualViewport);
120 visitor->trace(m_overscrollController); 118 visitor->trace(m_overscrollController);
121 visitor->trace(m_eventHandlerRegistry);
122 visitor->trace(m_consoleMessageStorage); 119 visitor->trace(m_consoleMessageStorage);
123 visitor->trace(m_globalRootScrollerController); 120 visitor->trace(m_globalRootScrollerController);
124 } 121 }
125 122
126 #if DCHECK_IS_ON() 123 #if DCHECK_IS_ON()
127 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { 124 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) {
128 ASSERT(expectedFrameCount >= 0); 125 ASSERT(expectedFrameCount >= 0);
129 126
130 int actualFrameCount = 0; 127 int actualFrameCount = 0;
131 for (; frame; frame = frame->tree().traverseNext()) 128 for (; frame; frame = frame->tree().traverseNext())
132 ++actualFrameCount; 129 ++actualFrameCount;
133 130
134 ASSERT(expectedFrameCount == actualFrameCount); 131 ASSERT(expectedFrameCount == actualFrameCount);
135 } 132 }
136 #endif 133 #endif
137 134
138 int FrameHost::subframeCount() const { 135 int FrameHost::subframeCount() const {
139 #if DCHECK_IS_ON() 136 #if DCHECK_IS_ON()
140 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); 137 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame());
141 #endif 138 #endif
142 return m_subframeCount; 139 return m_subframeCount;
143 } 140 }
144 141
145 } // namespace blink 142 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameHost.h ('k') | third_party/WebKit/Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698