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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1544443004: Alternate computation of axObjectCacheOwner to improve perf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 8ce94026ce0a80a89b6a8d59d8084551a8d60b6f..273fd5cb58948db813b8ae0544fdf3445be2033f 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -2311,22 +2311,22 @@ Document& Document::axObjectCacheOwner() const
// of the AXObjectCache (http://crbug.com/510410), but the proper fix
// will be for each Document to have its own AXObjectCache
// (http://crbug.com/532249).
-
+ Document* top = const_cast<Document*>(this);
LocalFrame* frame = this->frame();
if (!frame)
- return *const_cast<Document*>(this);
-
- frame = frame->localFrameRoot();
- if (!frame || !frame->document())
- return *const_cast<Document*>(this);
-
- Document* owner = frame->document();
- if (frame->pagePopupOwner()) {
- ASSERT(!owner->m_axObjectCache);
- return frame->pagePopupOwner()->document().axObjectCacheOwner();
+ return *top;
+ while (frame && frame->owner() && frame->owner()->isLocal()) {
dcheng 2015/12/28 22:12:19 Nit: add a comment so someone (e.g. me) doesn't se
dmazzoni 2015/12/29 00:13:08 Done.
+ HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner());
+ top = &owner->document();
+ frame = top->frame();
+ }
+ if (top->frame() && top->frame()->pagePopupOwner()) {
+ ASSERT(!top->m_axObjectCache);
+ return top->frame()->pagePopupOwner()->document().axObjectCacheOwner();
}
- return *owner;
+ ASSERT(top);
+ return *top;
}
void Document::clearAXObjectCache()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698