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

Side by Side Diff: third_party/WebKit/Source/web/OpenedFrameTracker.h

Issue 2706963004: Clear opener when frame is detached. (Closed)
Patch Set: Created 3 years, 10 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 // 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/HashSet.h" 8 #include "wtf/HashSet.h"
9 #include "wtf/Noncopyable.h" 9 #include "wtf/Noncopyable.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class Visitor;
14 class WebFrame; 13 class WebFrame;
15 14
16 // Small helper class to track the set of frames that a WebFrame has opened. 15 // Small helper class to track the set of frames that a WebFrame has opened.
17 // Due to layering restrictions, we need to hide the implementation, since 16 // Due to layering restrictions, we need to hide the implementation, since
18 // public/web/ cannot depend on wtf/. 17 // public/web/ cannot depend on wtf/.
19 class OpenedFrameTracker { 18 class OpenedFrameTracker {
20 WTF_MAKE_NONCOPYABLE(OpenedFrameTracker); 19 WTF_MAKE_NONCOPYABLE(OpenedFrameTracker);
21 20
22 public: 21 public:
23 OpenedFrameTracker(); 22 OpenedFrameTracker();
24 ~OpenedFrameTracker(); 23 ~OpenedFrameTracker();
25 24
26 bool isEmpty() const; 25 bool isEmpty() const;
27 void add(WebFrame*); 26 void add(WebFrame*);
28 void remove(WebFrame*); 27 void remove(WebFrame*);
29 28
30 // Helper used when swapping a frame into the frame tree: this updates the 29 // Helper used when swapping a frame into the frame tree: this updates the
31 // opener for opened frames to point to the new frame being swapped in. 30 // opener for opened frames to point to the new frame being swapped in.
32 void transferTo(WebFrame*); 31 void transferTo(WebFrame*);
33 32
34 void traceFrames(Visitor*); 33 // Helper function to clear the openers when the frame is being detached.
34 void detach() { transferTo(nullptr); }
dcheng 2017/02/21 21:59:37 Nit: call this dispose().
lfg 2017/02/21 22:04:50 Done.
35 35
36 private: 36 private:
37 WTF::HashSet<WebFrame*> m_openedFrames; 37 WTF::HashSet<WebFrame*> m_openedFrames;
38 }; 38 };
39 39
40 } // namespace blink 40 } // namespace blink
41 41
42 #endif // WebFramePrivate_h 42 #endif // WebFramePrivate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698