| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/page/scrolling/OverscrollController.h" | 35 #include "core/page/scrolling/OverscrollController.h" |
| 36 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
| 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) : m_page(&page) {} |
| 46 : m_page(&page), | |
| 47 m_subframeCount(0) {} | |
| 48 | 46 |
| 49 // Explicitly in the .cpp to avoid default constructor in .h | 47 // Explicitly in the .cpp to avoid default constructor in .h |
| 50 FrameHost::~FrameHost() {} | 48 FrameHost::~FrameHost() {} |
| 51 | 49 |
| 52 Page& FrameHost::page() { | 50 Page& FrameHost::page() { |
| 53 return *m_page; | 51 return *m_page; |
| 54 } | 52 } |
| 55 | 53 |
| 56 const Page& FrameHost::page() const { | 54 const Page& FrameHost::page() const { |
| 57 return *m_page; | 55 return *m_page; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 } | 76 } |
| 79 | 77 |
| 80 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { | 78 const ConsoleMessageStorage& FrameHost::consoleMessageStorage() const { |
| 81 return page().consoleMessageStorage(); | 79 return page().consoleMessageStorage(); |
| 82 } | 80 } |
| 83 | 81 |
| 84 DEFINE_TRACE(FrameHost) { | 82 DEFINE_TRACE(FrameHost) { |
| 85 visitor->trace(m_page); | 83 visitor->trace(m_page); |
| 86 } | 84 } |
| 87 | 85 |
| 88 #if DCHECK_IS_ON() | 86 void FrameHost::incrementSubframeCount() { |
| 89 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { | 87 page().incrementSubframeCount(); |
| 90 ASSERT(expectedFrameCount >= 0); | 88 } |
| 91 | 89 |
| 92 int actualFrameCount = 0; | 90 void FrameHost::decrementSubframeCount() { |
| 93 for (; frame; frame = frame->tree().traverseNext()) | 91 page().decrementSubframeCount(); |
| 94 ++actualFrameCount; | |
| 95 | |
| 96 ASSERT(expectedFrameCount == actualFrameCount); | |
| 97 } | 92 } |
| 98 #endif | |
| 99 | |
| 100 int FrameHost::subframeCount() const { | 93 int FrameHost::subframeCount() const { |
| 101 #if DCHECK_IS_ON() | 94 return page().subframeCount(); |
| 102 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); | |
| 103 #endif | |
| 104 return m_subframeCount; | |
| 105 } | 95 } |
| 106 | 96 |
| 107 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |