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