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

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

Issue 1124153003: [Oilpan] [Reland] Migrate classes under core/fetch to Oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Check m_fetcher in DocumentLoader Created 5 years, 5 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
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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 { 814 {
815 if (!m_customElementMicrotaskRunQueue) 815 if (!m_customElementMicrotaskRunQueue)
816 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e(); 816 m_customElementMicrotaskRunQueue = CustomElementMicrotaskRunQueue::creat e();
817 return m_customElementMicrotaskRunQueue.get(); 817 return m_customElementMicrotaskRunQueue.get();
818 } 818 }
819 819
820 void Document::setImportsController(HTMLImportsController* controller) 820 void Document::setImportsController(HTMLImportsController* controller)
821 { 821 {
822 ASSERT(!m_importsController || !controller); 822 ASSERT(!m_importsController || !controller);
823 m_importsController = controller; 823 m_importsController = controller;
824 if (!m_importsController && !loader()) 824 if (!m_importsController && !loader() && m_fetcher)
825 m_fetcher->clearContext(); 825 m_fetcher->clearContext();
826 } 826 }
827 827
828 HTMLImportLoader* Document::importLoader() const 828 HTMLImportLoader* Document::importLoader() const
829 { 829 {
830 if (!m_importsController) 830 if (!m_importsController)
831 return 0; 831 return 0;
832 return m_importsController->loaderFor(*this); 832 return m_importsController->loaderFor(*this);
833 } 833 }
834 834
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 2197
2198 styleEngine().didDetach(); 2198 styleEngine().didDetach();
2199 2199
2200 frameHost()->eventHandlerRegistry().documentDetached(*this); 2200 frameHost()->eventHandlerRegistry().documentDetached(*this);
2201 2201
2202 // If this Document is associated with a live DocumentLoader, the 2202 // If this Document is associated with a live DocumentLoader, the
2203 // DocumentLoader will take care of clearing the FetchContext. Deferring 2203 // DocumentLoader will take care of clearing the FetchContext. Deferring
2204 // to the DocumentLoader when possible also prevents prematurely clearing 2204 // to the DocumentLoader when possible also prevents prematurely clearing
2205 // the context in the case where multiple Documents end up associated with 2205 // the context in the case where multiple Documents end up associated with
2206 // a single DocumentLoader (e.g., navigating to a javascript: url). 2206 // a single DocumentLoader (e.g., navigating to a javascript: url).
2207 if (!loader()) 2207 if (!loader() && m_fetcher)
2208 m_fetcher->clearContext(); 2208 m_fetcher->clearContext();
2209 // If this document is the master for an HTMLImportsController, sever that 2209 // If this document is the master for an HTMLImportsController, sever that
2210 // relationship. This ensures that we don't leave import loads in flight, 2210 // relationship. This ensures that we don't leave import loads in flight,
2211 // thinking they should have access to a valid frame when they don't. 2211 // thinking they should have access to a valid frame when they don't.
2212 if (m_importsController) 2212 if (m_importsController)
2213 HTMLImportsController::removeFrom(*this); 2213 HTMLImportsController::removeFrom(*this);
2214 2214
2215 // This is required, as our LocalFrame might delete itself as soon as it det aches 2215 // This is required, as our LocalFrame might delete itself as soon as it det aches
2216 // us. However, this violates Node::detach() semantics, as it's never 2216 // us. However, this violates Node::detach() semantics, as it's never
2217 // possible to re-attach. Eventually Document::detach() should be renamed, 2217 // possible to re-attach. Eventually Document::detach() should be renamed,
2218 // or this setting of the frame to 0 could be made explicit in each of the 2218 // or this setting of the frame to 0 could be made explicit in each of the
2219 // callers of Document::detach(). 2219 // callers of Document::detach().
2220 m_frame = nullptr; 2220 m_frame = nullptr;
2221 2221
2222 if (m_mediaQueryMatcher) 2222 if (m_mediaQueryMatcher)
2223 m_mediaQueryMatcher->documentDetached(); 2223 m_mediaQueryMatcher->documentDetached();
2224 2224
2225 DocumentLifecycleNotifier::notifyDocumentWasDetached(); 2225 DocumentLifecycleNotifier::notifyDocumentWasDetached();
2226 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); 2226 m_lifecycle.advanceTo(DocumentLifecycle::Stopped);
2227 2227
2228 // FIXME: Currently we call notifyContextDestroyed() only in 2228 // FIXME: Currently we call notifyContextDestroyed() only in
2229 // Document::detach(), which means that we don't call 2229 // Document::detach(), which means that we don't call
2230 // notifyContextDestroyed() for a document that doesn't get detached. 2230 // notifyContextDestroyed() for a document that doesn't get detached.
2231 // If such a document has any observer, the observer won't get 2231 // If such a document has any observer, the observer won't get
2232 // a contextDestroyed() notification. This can happen for a document 2232 // a contextDestroyed() notification. This can happen for a document
2233 // created by DOMImplementation::createDocument(). 2233 // created by DOMImplementation::createDocument().
2234 DocumentLifecycleNotifier::notifyContextDestroyed(); 2234 DocumentLifecycleNotifier::notifyContextDestroyed();
2235 ExecutionContext::notifyContextDestroyed(); 2235 ExecutionContext::notifyContextDestroyed();
2236
2237 m_fetcher.clear();
2236 } 2238 }
2237 2239
2238 void Document::removeAllEventListeners() 2240 void Document::removeAllEventListeners()
2239 { 2241 {
2240 ContainerNode::removeAllEventListeners(); 2242 ContainerNode::removeAllEventListeners();
2241 2243
2242 if (LocalDOMWindow* domWindow = this->domWindow()) 2244 if (LocalDOMWindow* domWindow = this->domWindow())
2243 domWindow->removeAllEventListeners(); 2245 domWindow->removeAllEventListeners();
2244 } 2246 }
2245 2247
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
4628 InspectorInstrumentation::domContentLoadedEventFired(frame.get()); 4630 InspectorInstrumentation::domContentLoadedEventFired(frame.get());
4629 } 4631 }
4630 4632
4631 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes 4633 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes
4632 // so that dynamically inserted content can also benefit from sharing optimi zations. 4634 // so that dynamically inserted content can also benefit from sharing optimi zations.
4633 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept 4635 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept
4634 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer. 4636 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer.
4635 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); 4637 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE);
4636 4638
4637 // Parser should have picked up all preloads by now 4639 // Parser should have picked up all preloads by now
4638 m_fetcher->clearPreloads(); 4640 if (m_fetcher)
4641 m_fetcher->clearPreloads();
4639 } 4642 }
4640 4643
4641 void Document::elementDataCacheClearTimerFired(Timer<Document>*) 4644 void Document::elementDataCacheClearTimerFired(Timer<Document>*)
4642 { 4645 {
4643 m_elementDataCache.clear(); 4646 m_elementDataCache.clear();
4644 } 4647 }
4645 4648
4646 Vector<IconURL> Document::iconURLs(int iconTypesMask) 4649 Vector<IconURL> Document::iconURLs(int iconTypesMask)
4647 { 4650 {
4648 IconURL firstFavicon; 4651 IconURL firstFavicon;
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 #ifndef NDEBUG 5773 #ifndef NDEBUG
5771 using namespace blink; 5774 using namespace blink;
5772 void showLiveDocumentInstances() 5775 void showLiveDocumentInstances()
5773 { 5776 {
5774 WeakDocumentSet& set = liveDocumentSet(); 5777 WeakDocumentSet& set = liveDocumentSet();
5775 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5778 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5776 for (Document* document : set) 5779 for (Document* document : set)
5777 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5780 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5778 } 5781 }
5779 #endif 5782 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698