| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #ifndef SubframeTracker_h |
| 6 #define SubframeTracker_h |
| 7 |
| 8 #include "platform/heap/Handle.h" |
| 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/Noncopyable.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class HTMLFrameOwnerElement; |
| 15 class Node; |
| 16 |
| 17 class SubframeTracker final { |
| 18 WTF_MAKE_NONCOPYABLE(SubframeTracker); |
| 19 DISALLOW_NEW(); |
| 20 public: |
| 21 enum DisconnectPolicy { RootAndDescendants, DescendantsOnly }; |
| 22 |
| 23 SubframeTracker(); |
| 24 |
| 25 bool hasConnectedSubframes(Node&) const; |
| 26 void disconnectSubframesAt(Node&, DisconnectPolicy = RootAndDescendants); |
| 27 |
| 28 DECLARE_TRACE(); |
| 29 |
| 30 private: |
| 31 friend class HTMLFrameOwnerElement; |
| 32 |
| 33 void connectSubframe(HTMLFrameOwnerElement&); |
| 34 void disconnectSubframe(HTMLFrameOwnerElement&); |
| 35 |
| 36 // Set of nodes in a Document that have a descendant connected subframe. The |
| 37 // ordering of this set is similar to a pre-order, depth-first traversal of |
| 38 // the DOM tree, though relative traversal of sibling nodes is not |
| 39 // necessarily maintained. |
| 40 using SubframeNodeSet = WillBeHeapListHashSet<RawPtrWillBeMember<Node>>; |
| 41 SubframeNodeSet m_connectedSubframeNodes; |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif // SubframeTracker_h |
| OLD | NEW |