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

Unified Diff: third_party/WebKit/Source/core/dom/SubframeTracker.h

Issue 1770523002: Track connected subframes per-Document instead of per-Node. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix various crashes but still doesn't refcount tracked nodes (and needs to) Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/SubframeTracker.h
diff --git a/third_party/WebKit/Source/core/dom/SubframeTracker.h b/third_party/WebKit/Source/core/dom/SubframeTracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..2cd7a9134811f914c56cd4c6fff0f01b343d1030
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/SubframeTracker.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SubframeTracker_h
+#define SubframeTracker_h
+
+#include "platform/heap/Handle.h"
+#include "wtf/Allocator.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class HTMLFrameOwnerElement;
+class Node;
+
+class SubframeTracker final {
+ WTF_MAKE_NONCOPYABLE(SubframeTracker);
+ DISALLOW_NEW();
+public:
+ enum DisconnectPolicy { RootAndDescendants, DescendantsOnly };
+
+ SubframeTracker();
+
+ bool hasConnectedSubframes(Node&) const;
+ void disconnectSubframesAt(Node&, DisconnectPolicy = RootAndDescendants);
+
+ DECLARE_TRACE();
+
+private:
+ friend class HTMLFrameOwnerElement;
+
+ void connectSubframe(HTMLFrameOwnerElement&);
+ void disconnectSubframe(HTMLFrameOwnerElement&);
+
+ // Set of nodes in a Document that have a descendant connected subframe. The
+ // ordering of this set is similar to a pre-order, depth-first traversal of
+ // the DOM tree, though relative traversal of sibling nodes is not
+ // necessarily maintained.
+ using SubframeNodeSet = WillBeHeapListHashSet<RawPtrWillBeMember<Node>>;
+ SubframeNodeSet m_connectedSubframeNodes;
+};
+
+} // namespace blink
+
+#endif // SubframeTracker_h
« no previous file with comments | « third_party/WebKit/Source/core/dom/NodeRareData.cpp ('k') | third_party/WebKit/Source/core/dom/SubframeTracker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698