| 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 26 matching lines...) Expand all Loading... |
| 37 #include "public/platform/WebScheduler.h" | 37 #include "public/platform/WebScheduler.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 FrameHost* FrameHost::create(Page& page) { | 41 FrameHost* FrameHost::create(Page& page) { |
| 42 return new FrameHost(page); | 42 return new FrameHost(page); |
| 43 } | 43 } |
| 44 | 44 |
| 45 FrameHost::FrameHost(Page& page) | 45 FrameHost::FrameHost(Page& page) |
| 46 : m_page(&page), | 46 : m_page(&page), |
| 47 m_overscrollController( | |
| 48 OverscrollController::create(m_page->visualViewport(), | |
| 49 m_page->chromeClient())), | |
| 50 m_subframeCount(0) {} | 47 m_subframeCount(0) {} |
| 51 | 48 |
| 52 // Explicitly in the .cpp to avoid default constructor in .h | 49 // Explicitly in the .cpp to avoid default constructor in .h |
| 53 FrameHost::~FrameHost() {} | 50 FrameHost::~FrameHost() {} |
| 54 | 51 |
| 55 Page& FrameHost::page() { | 52 Page& FrameHost::page() { |
| 56 return *m_page; | 53 return *m_page; |
| 57 } | 54 } |
| 58 | 55 |
| 59 const Page& FrameHost::page() const { | 56 const Page& FrameHost::page() const { |
| 60 return *m_page; | 57 return *m_page; |
| 61 } | 58 } |
| 62 | 59 |
| 63 BrowserControls& FrameHost::browserControls() { | 60 BrowserControls& FrameHost::browserControls() { |
| 64 return m_page->browserControls(); | 61 return m_page->browserControls(); |
| 65 } | 62 } |
| 66 | 63 |
| 67 const BrowserControls& FrameHost::browserControls() const { | 64 const BrowserControls& FrameHost::browserControls() const { |
| 68 return m_page->browserControls(); | 65 return m_page->browserControls(); |
| 69 } | 66 } |
| 70 | 67 |
| 71 OverscrollController& FrameHost::overscrollController() { | 68 OverscrollController& FrameHost::overscrollController() { |
| 72 return *m_overscrollController; | 69 return page().overscrollController(); |
| 73 } | 70 } |
| 74 | 71 |
| 75 const OverscrollController& FrameHost::overscrollController() const { | 72 const OverscrollController& FrameHost::overscrollController() const { |
| 76 return *m_overscrollController; | 73 return page().overscrollController(); |
| 77 } | 74 } |
| 78 | 75 |
| 79 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { | 76 ConsoleMessageStorage& FrameHost::consoleMessageStorage() { |
| 80 return page().consoleMessageStorage(); | 77 return page().consoleMessageStorage(); |
| 81 } | 78 } |
| 82 | 79 |
| 83 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { | 80 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { |
| 84 return page().consoleMessageStorage(); | 81 return page().consoleMessageStorage(); |
| 85 } | 82 } |
| 86 | 83 |
| 87 DEFINE_TRACE(FrameHost) { | 84 DEFINE_TRACE(FrameHost) { |
| 88 visitor->trace(m_page); | 85 visitor->trace(m_page); |
| 89 visitor->trace(m_overscrollController); | |
| 90 } | 86 } |
| 91 | 87 |
| 92 #if DCHECK_IS_ON() | 88 #if DCHECK_IS_ON() |
| 93 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { | 89 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { |
| 94 ASSERT(expectedFrameCount >= 0); | 90 ASSERT(expectedFrameCount >= 0); |
| 95 | 91 |
| 96 int actualFrameCount = 0; | 92 int actualFrameCount = 0; |
| 97 for (; frame; frame = frame->tree().traverseNext()) | 93 for (; frame; frame = frame->tree().traverseNext()) |
| 98 ++actualFrameCount; | 94 ++actualFrameCount; |
| 99 | 95 |
| 100 ASSERT(expectedFrameCount == actualFrameCount); | 96 ASSERT(expectedFrameCount == actualFrameCount); |
| 101 } | 97 } |
| 102 #endif | 98 #endif |
| 103 | 99 |
| 104 int FrameHost::subframeCount() const { | 100 int FrameHost::subframeCount() const { |
| 105 #if DCHECK_IS_ON() | 101 #if DCHECK_IS_ON() |
| 106 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); | 102 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); |
| 107 #endif | 103 #endif |
| 108 return m_subframeCount; | 104 return m_subframeCount; |
| 109 } | 105 } |
| 110 | 106 |
| 111 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |