| 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 #ifndef OpenedFrameTracker_h | 5 #ifndef OpenedFrameTracker_h |
| 6 #define OpenedFrameTracker_h | 6 #define OpenedFrameTracker_h |
| 7 | 7 |
| 8 #include "wtf/FastAllocBase.h" | |
| 9 #include "wtf/HashSet.h" | 8 #include "wtf/HashSet.h" |
| 10 #include "wtf/Noncopyable.h" | 9 #include "wtf/Noncopyable.h" |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 | 12 |
| 14 class Visitor; | 13 class Visitor; |
| 15 class InlinedGlobalMarkingVisitor; | 14 class InlinedGlobalMarkingVisitor; |
| 16 class WebFrame; | 15 class WebFrame; |
| 17 | 16 |
| 18 // Small helper class to track the set of frames that a WebFrame has opened. | 17 // Small helper class to track the set of frames that a WebFrame has opened. |
| 19 // Due to layering restrictions, we need to hide the implementation, since | 18 // Due to layering restrictions, we need to hide the implementation, since |
| 20 // public/web/ cannot depend on wtf/. | 19 // public/web/ cannot depend on wtf/. |
| 21 class OpenedFrameTracker { | 20 class OpenedFrameTracker { |
| 22 WTF_MAKE_FAST_ALLOCATED(OpenedFrameTracker); | |
| 23 WTF_MAKE_NONCOPYABLE(OpenedFrameTracker); | 21 WTF_MAKE_NONCOPYABLE(OpenedFrameTracker); |
| 24 public: | 22 public: |
| 25 OpenedFrameTracker(); | 23 OpenedFrameTracker(); |
| 26 ~OpenedFrameTracker(); | 24 ~OpenedFrameTracker(); |
| 27 | 25 |
| 28 bool isEmpty() const; | 26 bool isEmpty() const; |
| 29 void add(WebFrame*); | 27 void add(WebFrame*); |
| 30 void remove(WebFrame*); | 28 void remove(WebFrame*); |
| 31 | 29 |
| 32 // Updates the opener for all tracked frames. | 30 // Updates the opener for all tracked frames. |
| 33 void updateOpener(WebFrame*); | 31 void updateOpener(WebFrame*); |
| 34 | 32 |
| 35 void traceFrames(Visitor*); | 33 void traceFrames(Visitor*); |
| 36 void traceFrames(InlinedGlobalMarkingVisitor); | 34 void traceFrames(InlinedGlobalMarkingVisitor); |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 template <typename VisitorDispatcher> | 37 template <typename VisitorDispatcher> |
| 40 void traceFramesImpl(VisitorDispatcher); | 38 void traceFramesImpl(VisitorDispatcher); |
| 41 | 39 |
| 42 WTF::HashSet<WebFrame*> m_openedFrames; | 40 WTF::HashSet<WebFrame*> m_openedFrames; |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 } // namespace blink | 43 } // namespace blink |
| 46 | 44 |
| 47 #endif // WebFramePrivate_h | 45 #endif // WebFramePrivate_h |
| OLD | NEW |