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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameHost.cpp

Issue 2739033003: Move FrameHost::m_subframeCount to Page (Closed)
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 FrameHost::FrameHost(Page& page) 48 FrameHost::FrameHost(Page& page)
49 : m_page(&page), 49 : m_page(&page),
50 m_visualViewport(VisualViewport::create(page)), 50 m_visualViewport(VisualViewport::create(page)),
51 m_overscrollController( 51 m_overscrollController(
52 OverscrollController::create(*m_visualViewport, 52 OverscrollController::create(*m_visualViewport,
53 m_page->chromeClient())), 53 m_page->chromeClient())),
54 m_consoleMessageStorage(new ConsoleMessageStorage()), 54 m_consoleMessageStorage(new ConsoleMessageStorage()),
55 m_globalRootScrollerController( 55 m_globalRootScrollerController(
56 TopDocumentRootScrollerController::create(page)), 56 TopDocumentRootScrollerController::create(page)) {}
57 m_subframeCount(0) {}
58 57
59 // Explicitly in the .cpp to avoid default constructor in .h 58 // Explicitly in the .cpp to avoid default constructor in .h
60 FrameHost::~FrameHost() {} 59 FrameHost::~FrameHost() {}
61 60
62 Page& FrameHost::page() { 61 Page& FrameHost::page() {
63 return *m_page; 62 return *m_page;
64 } 63 }
65 64
66 const Page& FrameHost::page() const { 65 const Page& FrameHost::page() const {
67 return *m_page; 66 return *m_page;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 104 }
106 105
107 DEFINE_TRACE(FrameHost) { 106 DEFINE_TRACE(FrameHost) {
108 visitor->trace(m_page); 107 visitor->trace(m_page);
109 visitor->trace(m_visualViewport); 108 visitor->trace(m_visualViewport);
110 visitor->trace(m_overscrollController); 109 visitor->trace(m_overscrollController);
111 visitor->trace(m_consoleMessageStorage); 110 visitor->trace(m_consoleMessageStorage);
112 visitor->trace(m_globalRootScrollerController); 111 visitor->trace(m_globalRootScrollerController);
113 } 112 }
114 113
115 #if DCHECK_IS_ON() 114 void FrameHost::incrementSubframeCount() {
116 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) { 115 page().incrementSubframeCount();
117 ASSERT(expectedFrameCount >= 0); 116 }
118 117
119 int actualFrameCount = 0; 118 void FrameHost::decrementSubframeCount() {
120 for (; frame; frame = frame->tree().traverseNext()) 119 page().decrementSubframeCount();
121 ++actualFrameCount;
122
123 ASSERT(expectedFrameCount == actualFrameCount);
124 } 120 }
125 #endif
126 121
127 int FrameHost::subframeCount() const { 122 int FrameHost::subframeCount() const {
128 #if DCHECK_IS_ON() 123 return page().subframeCount();
129 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame());
130 #endif
131 return m_subframeCount;
132 } 124 }
133 125
134 } // namespace blink 126 } // namespace blink
OLDNEW
« 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