Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/WebKit/Source/core/frame/FrameHost.cpp

Issue 2746873002: Revert of Move FrameHost::m_subframeCount to Page (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameHost.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.cpp b/third_party/WebKit/Source/core/frame/FrameHost.cpp
index dc19cfae5d8d030aae4cb9e72feec6f504e89037..e7ffb9b2a3e5b2da1bf7b3f0dbb239e8290e99fe 100644
--- a/third_party/WebKit/Source/core/frame/FrameHost.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameHost.cpp
@@ -53,7 +53,8 @@
m_page->chromeClient())),
m_consoleMessageStorage(new ConsoleMessageStorage()),
m_globalRootScrollerController(
- TopDocumentRootScrollerController::create(page)) {}
+ TopDocumentRootScrollerController::create(page)),
+ m_subframeCount(0) {}
// Explicitly in the .cpp to avoid default constructor in .h
FrameHost::~FrameHost() {}
@@ -111,16 +112,23 @@
visitor->trace(m_globalRootScrollerController);
}
-void FrameHost::incrementSubframeCount() {
- page().incrementSubframeCount();
+#if DCHECK_IS_ON()
+void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) {
+ ASSERT(expectedFrameCount >= 0);
+
+ int actualFrameCount = 0;
+ for (; frame; frame = frame->tree().traverseNext())
+ ++actualFrameCount;
+
+ ASSERT(expectedFrameCount == actualFrameCount);
}
-
-void FrameHost::decrementSubframeCount() {
- page().decrementSubframeCount();
-}
+#endif
int FrameHost::subframeCount() const {
- return page().subframeCount();
+#if DCHECK_IS_ON()
+ checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame());
+#endif
+ return m_subframeCount;
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameHost.h ('k') | third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698