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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 2463293003: Some speculation about making opaque root finding cheaper.
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
index 87d93525711c43f86222e5707988b4ec1ec0a64f..9b4ebfde87ab90475bf8359d4f54a2b1a24be015 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
@@ -41,6 +41,7 @@
#include "core/dom/Attr.h"
#include "core/dom/Element.h"
#include "core/dom/Node.h"
+#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/imports/HTMLImportsController.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "platform/Histogram.h"
@@ -92,6 +93,13 @@ Node* V8GCController::opaqueRootForGC(v8::Isolate*, Node* node) {
node = ownerElement;
}
+ // Node -> Host (if any) is O(1)
+ while (node->isInShadowTree())
+ node = &node->containingShadowRoot()->host();
+
+ // The "ShadowHost" part is redundant because of the isInShadowTree
+ // loop, but this is still preferable because parent/shadow host
+ // pointer occupies the same space.
while (Node* parent = node->parentOrShadowHostOrTemplateHostNode())
node = parent;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698