OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 FrameHost::FrameHost(Page& page) | 49 FrameHost::FrameHost(Page& page) |
50 : m_page(&page), | 50 : m_page(&page), |
51 m_visualViewport(VisualViewport::create(*this)), | 51 m_visualViewport(VisualViewport::create(*this)), |
52 m_overscrollController( | 52 m_overscrollController( |
53 OverscrollController::create(*m_visualViewport, | 53 OverscrollController::create(*m_visualViewport, |
54 m_page->chromeClient())), | 54 m_page->chromeClient())), |
55 m_eventHandlerRegistry(new EventHandlerRegistry(page)), | 55 m_eventHandlerRegistry(new EventHandlerRegistry(page)), |
56 m_consoleMessageStorage(new ConsoleMessageStorage()), | 56 m_consoleMessageStorage(new ConsoleMessageStorage()), |
57 m_globalRootScrollerController( | 57 m_globalRootScrollerController( |
58 TopDocumentRootScrollerController::create(*this)), | 58 TopDocumentRootScrollerController::create(*this)) {} |
59 m_subframeCount(0) {} | |
60 | 59 |
61 // Explicitly in the .cpp to avoid default constructor in .h | 60 // Explicitly in the .cpp to avoid default constructor in .h |
62 FrameHost::~FrameHost() {} | 61 FrameHost::~FrameHost() {} |
63 | 62 |
64 Page& FrameHost::page() { | 63 Page& FrameHost::page() { |
65 return *m_page; | 64 return *m_page; |
66 } | 65 } |
67 | 66 |
68 const Page& FrameHost::page() const { | 67 const Page& FrameHost::page() const { |
69 return *m_page; | 68 return *m_page; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 115 |
117 DEFINE_TRACE(FrameHost) { | 116 DEFINE_TRACE(FrameHost) { |
118 visitor->trace(m_page); | 117 visitor->trace(m_page); |
119 visitor->trace(m_visualViewport); | 118 visitor->trace(m_visualViewport); |
120 visitor->trace(m_overscrollController); | 119 visitor->trace(m_overscrollController); |
121 visitor->trace(m_eventHandlerRegistry); | 120 visitor->trace(m_eventHandlerRegistry); |
122 visitor->trace(m_consoleMessageStorage); | 121 visitor->trace(m_consoleMessageStorage); |
123 visitor->trace(m_globalRootScrollerController); | 122 visitor->trace(m_globalRootScrollerController); |
124 } | 123 } |
125 | 124 |
126 #if DCHECK_IS_ON() | 125 void FrameHost::incrementSubframeCount() { |
127 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { | 126 page().incrementSubframeCount(); |
128 ASSERT(expectedFrameCount >= 0); | 127 } |
129 | 128 |
130 int actualFrameCount = 0; | 129 void FrameHost::decrementSubframeCount() { |
131 for (; frame; frame = frame->tree().traverseNext()) | 130 page().decrementSubframeCount(); |
132 ++actualFrameCount; | |
133 | |
134 ASSERT(expectedFrameCount == actualFrameCount); | |
135 } | 131 } |
136 #endif | |
137 | 132 |
138 int FrameHost::subframeCount() const { | 133 int FrameHost::subframeCount() const { |
139 #if DCHECK_IS_ON() | 134 return page().subframeCount(); |
140 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); | |
141 #endif | |
142 return m_subframeCount; | |
143 } | 135 } |
144 | 136 |
145 } // namespace blink | 137 } // namespace blink |
OLD | NEW |