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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 } 2304 }
2305 2305
2306 Document& Document::axObjectCacheOwner() const 2306 Document& Document::axObjectCacheOwner() const
2307 { 2307 {
2308 // FIXME(dmazzoni): Currently there's one AXObjectCache per page, owned 2308 // FIXME(dmazzoni): Currently there's one AXObjectCache per page, owned
2309 // by the top document, but with --site-isolation the top document may 2309 // by the top document, but with --site-isolation the top document may
2310 // be a remote frame. As a quick fix we're making the local root the owner 2310 // be a remote frame. As a quick fix we're making the local root the owner
2311 // of the AXObjectCache (http://crbug.com/510410), but the proper fix 2311 // of the AXObjectCache (http://crbug.com/510410), but the proper fix
2312 // will be for each Document to have its own AXObjectCache 2312 // will be for each Document to have its own AXObjectCache
2313 // (http://crbug.com/532249). 2313 // (http://crbug.com/532249).
2314 2314 Document* top = const_cast<Document*>(this);
2315 LocalFrame* frame = this->frame(); 2315 LocalFrame* frame = this->frame();
2316 if (!frame) 2316 if (!frame)
2317 return *const_cast<Document*>(this); 2317 return *top;
2318 2318 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.
2319 frame = frame->localFrameRoot(); 2319 HTMLFrameOwnerElement* owner = toHTMLFrameOwnerElement(frame->owner());
2320 if (!frame || !frame->document()) 2320 top = &owner->document();
2321 return *const_cast<Document*>(this); 2321 frame = top->frame();
2322 2322 }
2323 Document* owner = frame->document(); 2323 if (top->frame() && top->frame()->pagePopupOwner()) {
2324 if (frame->pagePopupOwner()) { 2324 ASSERT(!top->m_axObjectCache);
2325 ASSERT(!owner->m_axObjectCache); 2325 return top->frame()->pagePopupOwner()->document().axObjectCacheOwner();
2326 return frame->pagePopupOwner()->document().axObjectCacheOwner();
2327 } 2326 }
2328 2327
2329 return *owner; 2328 ASSERT(top);
2329 return *top;
2330 } 2330 }
2331 2331
2332 void Document::clearAXObjectCache() 2332 void Document::clearAXObjectCache()
2333 { 2333 {
2334 ASSERT(&axObjectCacheOwner() == this); 2334 ASSERT(&axObjectCacheOwner() == this);
2335 // Clear the cache member variable before calling delete because attempts 2335 // Clear the cache member variable before calling delete because attempts
2336 // are made to access it during destruction. 2336 // are made to access it during destruction.
2337 if (m_axObjectCache) 2337 if (m_axObjectCache)
2338 m_axObjectCache->dispose(); 2338 m_axObjectCache->dispose();
2339 m_axObjectCache.clear(); 2339 m_axObjectCache.clear();
(...skipping 3514 matching lines...) Expand 10 before | Expand all | Expand 10 after
5854 #ifndef NDEBUG 5854 #ifndef NDEBUG
5855 using namespace blink; 5855 using namespace blink;
5856 void showLiveDocumentInstances() 5856 void showLiveDocumentInstances()
5857 { 5857 {
5858 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5858 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5859 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5859 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5860 for (Document* document : set) 5860 for (Document* document : set)
5861 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5861 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5862 } 5862 }
5863 #endif 5863 #endif
OLDNEW
« 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