| 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 16 matching lines...) Expand all Loading... |
| 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/FrameView.h" | 33 #include "core/frame/FrameView.h" |
| 34 #include "core/inspector/ConsoleMessageStorage.h" | 34 #include "core/inspector/ConsoleMessageStorage.h" |
| 35 #include "core/page/Page.h" | 35 #include "core/page/Page.h" |
| 36 #include "core/page/scrolling/OverscrollController.h" | 36 #include "core/page/scrolling/OverscrollController.h" |
| 37 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | |
| 38 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 39 #include "public/platform/WebScheduler.h" | 38 #include "public/platform/WebScheduler.h" |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 FrameHost* FrameHost::create(Page& page) { | 42 FrameHost* FrameHost::create(Page& page) { |
| 44 return new FrameHost(page); | 43 return new FrameHost(page); |
| 45 } | 44 } |
| 46 | 45 |
| 47 FrameHost::FrameHost(Page& page) | 46 FrameHost::FrameHost(Page& page) |
| 48 : m_page(&page), | 47 : m_page(&page), |
| 49 m_overscrollController( | 48 m_overscrollController( |
| 50 OverscrollController::create(m_page->visualViewport(), | 49 OverscrollController::create(m_page->visualViewport(), |
| 51 m_page->chromeClient())), | 50 m_page->chromeClient())), |
| 52 m_consoleMessageStorage(new ConsoleMessageStorage()), | 51 m_consoleMessageStorage(new ConsoleMessageStorage()), |
| 53 m_globalRootScrollerController( | |
| 54 TopDocumentRootScrollerController::create(page)), | |
| 55 m_subframeCount(0) {} | 52 m_subframeCount(0) {} |
| 56 | 53 |
| 57 // Explicitly in the .cpp to avoid default constructor in .h | 54 // Explicitly in the .cpp to avoid default constructor in .h |
| 58 FrameHost::~FrameHost() {} | 55 FrameHost::~FrameHost() {} |
| 59 | 56 |
| 60 Page& FrameHost::page() { | 57 Page& FrameHost::page() { |
| 61 return *m_page; | 58 return *m_page; |
| 62 } | 59 } |
| 63 | 60 |
| 64 const Page& FrameHost::page() const { | 61 const Page& FrameHost::page() const { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { | 81 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { |
| 85 return *m_consoleMessageStorage; | 82 return *m_consoleMessageStorage; |
| 86 } | 83 } |
| 87 | 84 |
| 88 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { | 85 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { |
| 89 return *m_consoleMessageStorage; | 86 return *m_consoleMessageStorage; |
| 90 } | 87 } |
| 91 | 88 |
| 92 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController() | 89 TopDocumentRootScrollerController& FrameHost::globalRootScrollerController() |
| 93 const { | 90 const { |
| 94 return *m_globalRootScrollerController; | 91 return page().globalRootScrollerController(); |
| 95 } | 92 } |
| 96 | 93 |
| 97 DEFINE_TRACE(FrameHost) { | 94 DEFINE_TRACE(FrameHost) { |
| 98 visitor->trace(m_page); | 95 visitor->trace(m_page); |
| 99 visitor->trace(m_overscrollController); | 96 visitor->trace(m_overscrollController); |
| 100 visitor->trace(m_consoleMessageStorage); | 97 visitor->trace(m_consoleMessageStorage); |
| 101 visitor->trace(m_globalRootScrollerController); | |
| 102 } | 98 } |
| 103 | 99 |
| 104 #if DCHECK_IS_ON() | 100 #if DCHECK_IS_ON() |
| 105 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { | 101 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { |
| 106 ASSERT(expectedFrameCount >= 0); | 102 ASSERT(expectedFrameCount >= 0); |
| 107 | 103 |
| 108 int actualFrameCount = 0; | 104 int actualFrameCount = 0; |
| 109 for (; frame; frame = frame->tree().traverseNext()) | 105 for (; frame; frame = frame->tree().traverseNext()) |
| 110 ++actualFrameCount; | 106 ++actualFrameCount; |
| 111 | 107 |
| 112 ASSERT(expectedFrameCount == actualFrameCount); | 108 ASSERT(expectedFrameCount == actualFrameCount); |
| 113 } | 109 } |
| 114 #endif | 110 #endif |
| 115 | 111 |
| 116 int FrameHost::subframeCount() const { | 112 int FrameHost::subframeCount() const { |
| 117 #if DCHECK_IS_ON() | 113 #if DCHECK_IS_ON() |
| 118 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); | 114 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); |
| 119 #endif | 115 #endif |
| 120 return m_subframeCount; | 116 return m_subframeCount; |
| 121 } | 117 } |
| 122 | 118 |
| 123 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |