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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 1116773003: Remove unnecessary clearing of AX object cache in Document destructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 #ifndef NDEBUG 523 #ifndef NDEBUG
524 liveDocumentSet().add(this); 524 liveDocumentSet().add(this);
525 #endif 525 #endif
526 } 526 }
527 527
528 Document::~Document() 528 Document::~Document()
529 { 529 {
530 ASSERT(!layoutView()); 530 ASSERT(!layoutView());
531 ASSERT(!parentTreeScope()); 531 ASSERT(!parentTreeScope());
532 // If a top document with a cache, verify that it was comprehensively
533 // cleared during detach.
534 ASSERT(!m_axObjectCache);
532 #if !ENABLE(OILPAN) 535 #if !ENABLE(OILPAN)
533 ASSERT(m_ranges.isEmpty()); 536 ASSERT(m_ranges.isEmpty());
534 ASSERT(!hasGuardRefCount()); 537 ASSERT(!hasGuardRefCount());
535 // With Oilpan, either the document outlives the visibility observers 538 // With Oilpan, either the document outlives the visibility observers
536 // or the visibility observers and the document die in the same GC round. 539 // or the visibility observers and the document die in the same GC round.
537 // When they die in the same GC round, the list of visibility observers 540 // When they die in the same GC round, the list of visibility observers
538 // will not be empty on Document destruction. 541 // will not be empty on Document destruction.
539 ASSERT(m_visibilityObservers.isEmpty()); 542 ASSERT(m_visibilityObservers.isEmpty());
540 543
541 if (m_templateDocument) 544 if (m_templateDocument)
542 m_templateDocument->m_templateDocumentHost = nullptr; // balanced in ens ureTemplateDocument(). 545 m_templateDocument->m_templateDocumentHost = nullptr; // balanced in ens ureTemplateDocument().
543 546
544 m_scriptRunner.clear(); 547 m_scriptRunner.clear();
545 548
546 // FIXME: Oilpan: Not removing event listeners here also means that we do 549 // FIXME: Oilpan: Not removing event listeners here also means that we do
547 // not notify the inspector instrumentation that the event listeners are 550 // not notify the inspector instrumentation that the event listeners are
548 // gone. The Document and all the nodes in the document are gone, so maybe 551 // gone. The Document and all the nodes in the document are gone, so maybe
549 // that is OK? 552 // that is OK?
550 removeAllEventListenersRecursively(); 553 removeAllEventListenersRecursively();
551 554
552 // Currently we believe that Document can never outlive the parser. 555 // Currently we believe that Document can never outlive the parser.
553 // Although the Document may be replaced synchronously, DocumentParsers 556 // Although the Document may be replaced synchronously, DocumentParsers
554 // generally keep at least one reference to an Element which would in turn 557 // generally keep at least one reference to an Element which would in turn
555 // has a reference to the Document. If you hit this ASSERT, then that 558 // has a reference to the Document. If you hit this ASSERT, then that
556 // assumption is wrong. DocumentParser::detach() should ensure that even 559 // assumption is wrong. DocumentParser::detach() should ensure that even
557 // if the DocumentParser outlives the Document it won't cause badness. 560 // if the DocumentParser outlives the Document it won't cause badness.
558 ASSERT(!m_parser || m_parser->refCount() == 1); 561 ASSERT(!m_parser || m_parser->refCount() == 1);
559 detachParser(); 562 detachParser();
560 #endif
561 563
562 if (this == &axObjectCacheOwner())
563 clearAXObjectCache();
564
565 #if !ENABLE(OILPAN)
566 if (m_styleSheetList) 564 if (m_styleSheetList)
567 m_styleSheetList->detachFromDocument(); 565 m_styleSheetList->detachFromDocument();
568 566
569 if (m_importsController) 567 if (m_importsController)
570 HTMLImportsController::removeFrom(*this); 568 HTMLImportsController::removeFrom(*this);
571 569
572 m_timeline->detachFromDocument(); 570 m_timeline->detachFromDocument();
573 571
574 // We need to destroy CSSFontSelector before destroying m_fetcher. 572 // We need to destroy CSSFontSelector before destroying m_fetcher.
575 m_styleEngine->detachFromDocument(); 573 m_styleEngine->detachFromDocument();
(...skipping 5181 matching lines...) Expand 10 before | Expand all | Expand 10 after
5757 #ifndef NDEBUG 5755 #ifndef NDEBUG
5758 using namespace blink; 5756 using namespace blink;
5759 void showLiveDocumentInstances() 5757 void showLiveDocumentInstances()
5760 { 5758 {
5761 WeakDocumentSet& set = liveDocumentSet(); 5759 WeakDocumentSet& set = liveDocumentSet();
5762 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5760 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5763 for (Document* document : set) 5761 for (Document* document : set)
5764 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5762 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5765 } 5763 }
5766 #endif 5764 #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