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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PassOwnPtrWillBeRawPtr<FrameHost> FrameHost::create(Page& page) | 42 PassOwnPtrWillBeRawPtr<FrameHost> FrameHost::create(Page& page) |
43 { | 43 { |
44 return adoptPtrWillBeNoop(new FrameHost(page)); | 44 return adoptPtrWillBeNoop(new FrameHost(page)); |
45 } | 45 } |
46 | 46 |
47 FrameHost::FrameHost(Page& page) | 47 FrameHost::FrameHost(Page& page) |
48 : m_page(&page) | 48 : m_page(&page) |
49 , m_pinchViewport(PinchViewport::create(*this)) | 49 , m_pinchViewport(PinchViewport::create(*this)) |
50 , m_eventHandlerRegistry(adoptPtrWillBeNoop(new EventHandlerRegistry(*this))
) | 50 , m_eventHandlerRegistry(adoptPtrWillBeNoop(new EventHandlerRegistry(*this))
) |
51 , m_consoleMessageStorage(ConsoleMessageStorage::createForFrameHost(this)) | 51 , m_consoleMessageStorage(ConsoleMessageStorage::createForFrameHost(this)) |
| 52 , m_subframeCount(0) |
52 { | 53 { |
53 } | 54 } |
54 | 55 |
55 // Explicitly in the .cpp to avoid default constructor in .h | 56 // Explicitly in the .cpp to avoid default constructor in .h |
56 FrameHost::~FrameHost() | 57 FrameHost::~FrameHost() |
57 { | 58 { |
58 } | 59 } |
59 | 60 |
60 Settings& FrameHost::settings() const | 61 Settings& FrameHost::settings() const |
61 { | 62 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 94 } |
94 | 95 |
95 void FrameHost::trace(Visitor* visitor) | 96 void FrameHost::trace(Visitor* visitor) |
96 { | 97 { |
97 visitor->trace(m_page); | 98 visitor->trace(m_page); |
98 visitor->trace(m_pinchViewport); | 99 visitor->trace(m_pinchViewport); |
99 visitor->trace(m_eventHandlerRegistry); | 100 visitor->trace(m_eventHandlerRegistry); |
100 visitor->trace(m_consoleMessageStorage); | 101 visitor->trace(m_consoleMessageStorage); |
101 } | 102 } |
102 | 103 |
| 104 #if ENABLE(ASSERT) |
| 105 void checkFrameCountConsistency(int expectedFrameCount, Frame* frame) |
| 106 { |
| 107 ASSERT(expectedFrameCount >= 0); |
| 108 |
| 109 int actualFrameCount = 0; |
| 110 for (; frame; frame = frame->tree().traverseNext()) |
| 111 ++actualFrameCount; |
| 112 |
| 113 ASSERT(expectedFrameCount == actualFrameCount); |
103 } | 114 } |
| 115 #endif |
| 116 |
| 117 int FrameHost::subframeCount() const |
| 118 { |
| 119 #if ENABLE(ASSERT) |
| 120 checkFrameCountConsistency(m_subframeCount + 1, m_page->mainFrame()); |
| 121 #endif |
| 122 return m_subframeCount; |
| 123 } |
| 124 |
| 125 } |
OLD | NEW |