Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / web / OpenedFrameTracker.h
blob1b5bbb6dc1504382e61c8ee10682f7a03d57d31e
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
3 // found in the LICENSE file.
5 #ifndef OpenedFrameTracker_h
6 #define OpenedFrameTracker_h
8 #include "wtf/HashSet.h"
9 #include "wtf/Noncopyable.h"
11 namespace blink {
13 class Visitor;
14 class InlinedGlobalMarkingVisitor;
15 class WebFrame;
17 // Small helper class to track the set of frames that a WebFrame has opened.
18 // Due to layering restrictions, we need to hide the implementation, since
19 // public/web/ cannot depend on wtf/.
20 class OpenedFrameTracker {
21 WTF_MAKE_NONCOPYABLE(OpenedFrameTracker);
22 public:
23 OpenedFrameTracker();
24 ~OpenedFrameTracker();
26 bool isEmpty() const;
27 void add(WebFrame*);
28 void remove(WebFrame*);
30 // Updates the opener for all tracked frames.
31 void updateOpener(WebFrame*);
33 void traceFrames(Visitor*);
34 void traceFrames(InlinedGlobalMarkingVisitor);
36 private:
37 template <typename VisitorDispatcher>
38 void traceFramesImpl(VisitorDispatcher);
40 WTF::HashSet<WebFrame*> m_openedFrames;
43 } // namespace blink
45 #endif // WebFramePrivate_h