Index: Source/core/frame/FrameHost.cpp |
diff --git a/Source/core/frame/FrameHost.cpp b/Source/core/frame/FrameHost.cpp |
index 2576f898a13095d7b49b2cb525811cd8a8f849b1..a2f861fbc8ea6e178388053ba8fd9398762aaeba 100644 |
--- a/Source/core/frame/FrameHost.cpp |
+++ b/Source/core/frame/FrameHost.cpp |
@@ -49,6 +49,7 @@ FrameHost::FrameHost(Page& page) |
, m_pinchViewport(PinchViewport::create(*this)) |
, m_eventHandlerRegistry(adoptPtrWillBeNoop(new EventHandlerRegistry(*this))) |
, m_consoleMessageStorage(ConsoleMessageStorage::createForFrameHost(this)) |
+ , m_subframeCount(0) |
{ |
} |
@@ -100,4 +101,25 @@ void FrameHost::trace(Visitor* visitor) |
visitor->trace(m_consoleMessageStorage); |
} |
+#if ENABLE(ASSERT) |
+void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) |
+{ |
+ ASSERT(expectedFrameCount >= 0); |
+ |
+ int actualFrameCount = 0; |
+ for (; frame; frame = frame->tree().traverseNext()) |
+ ++actualFrameCount; |
+ |
+ ASSERT(expectedFrameCount == actualFrameCount); |
+} |
+#endif |
+ |
+int FrameHost::subframeCount() const |
+{ |
+#if ENABLE(ASSERT) |
+ checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); |
+#endif |
+ return m_subframeCount; |
+} |
+ |
} |