OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "web/OpenedFrameTracker.h" | 6 #include "web/OpenedFrameTracker.h" |
7 | 7 |
| 8 #include "platform/heap/Handle.h" |
8 #include "public/web/WebFrame.h" | 9 #include "public/web/WebFrame.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 OpenedFrameTracker::OpenedFrameTracker() | 13 OpenedFrameTracker::OpenedFrameTracker() |
13 { | 14 { |
14 } | 15 } |
15 | 16 |
16 OpenedFrameTracker::~OpenedFrameTracker() | 17 OpenedFrameTracker::~OpenedFrameTracker() |
17 { | 18 { |
| 19 #if !ENABLE(OILPAN) |
| 20 // Oilpan takes care of clearing weak m_opener fields during GC. |
18 updateOpener(0); | 21 updateOpener(0); |
| 22 #endif |
19 } | 23 } |
20 | 24 |
21 bool OpenedFrameTracker::isEmpty() const | 25 bool OpenedFrameTracker::isEmpty() const |
22 { | 26 { |
23 return m_openedFrames.isEmpty(); | 27 return m_openedFrames.isEmpty(); |
24 } | 28 } |
25 | 29 |
26 void OpenedFrameTracker::add(WebFrame* frame) | 30 void OpenedFrameTracker::add(WebFrame* frame) |
27 { | 31 { |
28 m_openedFrames.add(frame); | 32 m_openedFrames.add(frame); |
29 } | 33 } |
30 | 34 |
31 void OpenedFrameTracker::remove(WebFrame* frame) | 35 void OpenedFrameTracker::remove(WebFrame* frame) |
32 { | 36 { |
33 m_openedFrames.remove(frame); | 37 m_openedFrames.remove(frame); |
34 } | 38 } |
35 | 39 |
36 void OpenedFrameTracker::updateOpener(WebFrame* frame) | 40 void OpenedFrameTracker::updateOpener(WebFrame* frame) |
37 { | 41 { |
38 HashSet<WebFrame*>::iterator end = m_openedFrames.end(); | 42 HashSet<WebFrame*>::iterator end = m_openedFrames.end(); |
39 for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++
it) | 43 for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++
it) |
40 (*it)->m_opener = frame; | 44 (*it)->m_opener = frame; |
41 } | 45 } |
42 | 46 |
| 47 void OpenedFrameTracker::traceFrames(Visitor* visitor) |
| 48 { |
| 49 #if ENABLE(OILPAN) |
| 50 HashSet<WebFrame*>::iterator end = m_openedFrames.end(); |
| 51 for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++
it) |
| 52 WebFrame::traceFrame(visitor, *it); |
| 53 #endif |
| 54 } |
| 55 |
43 } // namespace blink | 56 } // namespace blink |
OLD | NEW |