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