| 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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 | 1775 |
| 1776 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can | 1776 // Entering here from inside layout or paint would be catastrophic since rec
alcStyle can |
| 1777 // tear down the render tree or (unfortunately) run script. Kill the whole r
enderer if | 1777 // tear down the render tree or (unfortunately) run script. Kill the whole r
enderer if |
| 1778 // someone managed to get into here from inside layout or paint. | 1778 // someone managed to get into here from inside layout or paint. |
| 1779 RELEASE_ASSERT(!view()->isInPerformLayout()); | 1779 RELEASE_ASSERT(!view()->isInPerformLayout()); |
| 1780 RELEASE_ASSERT(!view()->isPainting()); | 1780 RELEASE_ASSERT(!view()->isPainting()); |
| 1781 | 1781 |
| 1782 // Script can run below in WidgetUpdates, so protect the LocalFrame. | 1782 // Script can run below in WidgetUpdates, so protect the LocalFrame. |
| 1783 // FIXME: Can this still happen? How does script run inside | 1783 // FIXME: Can this still happen? How does script run inside |
| 1784 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? | 1784 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? |
| 1785 RefPtr<LocalFrame> protect(m_frame); | 1785 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 1786 | 1786 |
| 1787 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree"); | 1787 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree"); |
| 1788 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); | 1788 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); |
| 1789 | 1789 |
| 1790 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC
ount() on the resolver. | 1790 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC
ount() on the resolver. |
| 1791 m_styleRecalcElementCounter = 0; | 1791 m_styleRecalcElementCounter = 0; |
| 1792 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul
ateStyles", "frame", frame()); | 1792 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul
ateStyles", "frame", frame()); |
| 1793 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 1793 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); |
| 1794 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 1794 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 1795 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc
ulateStyle(this); | 1795 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc
ulateStyle(this); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2193 | 2193 |
| 2194 m_styleEngine->didDetach(); | 2194 m_styleEngine->didDetach(); |
| 2195 | 2195 |
| 2196 frameHost()->eventHandlerRegistry().documentDetached(*this); | 2196 frameHost()->eventHandlerRegistry().documentDetached(*this); |
| 2197 | 2197 |
| 2198 // This is required, as our LocalFrame might delete itself as soon as it det
aches | 2198 // This is required, as our LocalFrame might delete itself as soon as it det
aches |
| 2199 // us. However, this violates Node::detach() semantics, as it's never | 2199 // us. However, this violates Node::detach() semantics, as it's never |
| 2200 // possible to re-attach. Eventually Document::detach() should be renamed, | 2200 // possible to re-attach. Eventually Document::detach() should be renamed, |
| 2201 // or this setting of the frame to 0 could be made explicit in each of the | 2201 // or this setting of the frame to 0 could be made explicit in each of the |
| 2202 // callers of Document::detach(). | 2202 // callers of Document::detach(). |
| 2203 m_frame = 0; | 2203 m_frame = nullptr; |
| 2204 | 2204 |
| 2205 if (m_mediaQueryMatcher) | 2205 if (m_mediaQueryMatcher) |
| 2206 m_mediaQueryMatcher->documentDetached(); | 2206 m_mediaQueryMatcher->documentDetached(); |
| 2207 | 2207 |
| 2208 lifecycleNotifier().notifyDocumentWasDetached(); | 2208 lifecycleNotifier().notifyDocumentWasDetached(); |
| 2209 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); | 2209 m_lifecycle.advanceTo(DocumentLifecycle::Stopped); |
| 2210 #if ENABLE(OILPAN) | 2210 #if ENABLE(OILPAN) |
| 2211 // Done with the window, explicitly clear to hasten its | 2211 // Done with the window, explicitly clear to hasten its |
| 2212 // destruction. | 2212 // destruction. |
| 2213 clearDOMWindow(); | 2213 clearDOMWindow(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 { | 2250 { |
| 2251 ASSERT(&axObjectCacheOwner() == this); | 2251 ASSERT(&axObjectCacheOwner() == this); |
| 2252 // Clear the cache member variable before calling delete because attempts | 2252 // Clear the cache member variable before calling delete because attempts |
| 2253 // are made to access it during destruction. | 2253 // are made to access it during destruction. |
| 2254 m_axObjectCache.clear(); | 2254 m_axObjectCache.clear(); |
| 2255 } | 2255 } |
| 2256 | 2256 |
| 2257 AXObjectCache* Document::existingAXObjectCache() const | 2257 AXObjectCache* Document::existingAXObjectCache() const |
| 2258 { | 2258 { |
| 2259 // If the renderer is gone then we are in the process of destruction. | 2259 // If the renderer is gone then we are in the process of destruction. |
| 2260 // This method will be called before m_frame = 0. | 2260 // This method will be called before m_frame = nullptr. |
| 2261 if (!axObjectCacheOwner().renderView()) | 2261 if (!axObjectCacheOwner().renderView()) |
| 2262 return 0; | 2262 return 0; |
| 2263 | 2263 |
| 2264 return axObjectCacheOwner().m_axObjectCache.get(); | 2264 return axObjectCacheOwner().m_axObjectCache.get(); |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 AXObjectCache* Document::axObjectCache() const | 2267 AXObjectCache* Document::axObjectCache() const |
| 2268 { | 2268 { |
| 2269 Settings* settings = this->settings(); | 2269 Settings* settings = this->settings(); |
| 2270 if (!settings || !settings->accessibilityEnabled()) | 2270 if (!settings || !settings->accessibilityEnabled()) |
| (...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4622 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim
e(); | 4622 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim
e(); |
| 4623 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); | 4623 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); |
| 4624 if (!m_documentTiming.domContentLoadedEventEnd) | 4624 if (!m_documentTiming.domContentLoadedEventEnd) |
| 4625 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime(
); | 4625 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime(
); |
| 4626 | 4626 |
| 4627 // The loader's finishedParsing() method may invoke script that causes this
object to | 4627 // The loader's finishedParsing() method may invoke script that causes this
object to |
| 4628 // be dereferenced (when this document is in an iframe and the onload causes
the iframe's src to change). | 4628 // be dereferenced (when this document is in an iframe and the onload causes
the iframe's src to change). |
| 4629 // Keep it alive until we are done. | 4629 // Keep it alive until we are done. |
| 4630 RefPtrWillBeRawPtr<Document> protect(this); | 4630 RefPtrWillBeRawPtr<Document> protect(this); |
| 4631 | 4631 |
| 4632 if (RefPtr<LocalFrame> f = frame()) { | 4632 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) { |
| 4633 // Don't update the render tree if we haven't requested the main resourc
e yet to avoid | 4633 // Don't update the render tree if we haven't requested the main resourc
e yet to avoid |
| 4634 // adding extra latency. Note that the first render tree update can be e
xpensive since it | 4634 // adding extra latency. Note that the first render tree update can be e
xpensive since it |
| 4635 // triggers the parsing of the default stylesheets which are compiled-in
. | 4635 // triggers the parsing of the default stylesheets which are compiled-in
. |
| 4636 const bool mainResourceWasAlreadyRequested = | 4636 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin
e()->committedFirstRealDocumentLoad(); |
| 4637 m_frame->loader().stateMachine()->committedFirstRealDocumentLoad(); | |
| 4638 | 4637 |
| 4639 // FrameLoader::finishedParsing() might end up calling Document::implici
tClose() if all | 4638 // FrameLoader::finishedParsing() might end up calling Document::implici
tClose() if all |
| 4640 // resource loads are complete. HTMLObjectElements can start loading the
ir resources from | 4639 // resource loads are complete. HTMLObjectElements can start loading the
ir resources from |
| 4641 // post attach callbacks triggered by recalcStyle(). This means if we p
arse out an <object> | 4640 // post attach callbacks triggered by recalcStyle(). This means if we p
arse out an <object> |
| 4642 // tag and then reach the end of the document without updating styles, w
e might not have yet | 4641 // tag and then reach the end of the document without updating styles, w
e might not have yet |
| 4643 // started the resource load and might fire the window load event too ea
rly. To avoid this | 4642 // started the resource load and might fire the window load event too ea
rly. To avoid this |
| 4644 // we force the styles to be up to date before calling FrameLoader::fini
shedParsing(). | 4643 // we force the styles to be up to date before calling FrameLoader::fini
shedParsing(). |
| 4645 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com
ment 35. | 4644 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com
ment 35. |
| 4646 if (mainResourceWasAlreadyRequested) | 4645 if (mainResourceWasAlreadyRequested) |
| 4647 updateRenderTreeIfNeeded(); | 4646 updateRenderTreeIfNeeded(); |
| 4648 | 4647 |
| 4649 f->loader().finishedParsing(); | 4648 frame->loader().finishedParsing(); |
| 4650 | 4649 |
| 4651 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Ma
rkDOMContent", "data", InspectorMarkLoadEvent::data(f.get())); | 4650 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Ma
rkDOMContent", "data", InspectorMarkLoadEvent::data(frame.get())); |
| 4652 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. | 4651 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti
meline migrates to tracing. |
| 4653 InspectorInstrumentation::domContentLoadedEventFired(f.get()); | 4652 InspectorInstrumentation::domContentLoadedEventFired(frame.get()); |
| 4654 } | 4653 } |
| 4655 | 4654 |
| 4656 // Schedule dropping of the ElementDataCache. We keep it alive for a while a
fter parsing finishes | 4655 // Schedule dropping of the ElementDataCache. We keep it alive for a while a
fter parsing finishes |
| 4657 // so that dynamically inserted content can also benefit from sharing optimi
zations. | 4656 // so that dynamically inserted content can also benefit from sharing optimi
zations. |
| 4658 // Note that we don't refresh the timer on cache access since that could lea
d to huge caches being kept | 4657 // Note that we don't refresh the timer on cache access since that could lea
d to huge caches being kept |
| 4659 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. | 4658 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. |
| 4660 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); | 4659 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); |
| 4661 | 4660 |
| 4662 // Parser should have picked up all preloads by now | 4661 // Parser should have picked up all preloads by now |
| 4663 m_fetcher->clearPreloads(); | 4662 m_fetcher->clearPreloads(); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5783 for (int i = 0; i < numNodeListInvalidationTypes; ++i) | 5782 for (int i = 0; i < numNodeListInvalidationTypes; ++i) |
| 5784 visitor->trace(m_nodeLists[i]); | 5783 visitor->trace(m_nodeLists[i]); |
| 5785 visitor->trace(m_cssCanvasElements); | 5784 visitor->trace(m_cssCanvasElements); |
| 5786 visitor->trace(m_topLayerElements); | 5785 visitor->trace(m_topLayerElements); |
| 5787 visitor->trace(m_elemSheet); | 5786 visitor->trace(m_elemSheet); |
| 5788 visitor->trace(m_nodeIterators); | 5787 visitor->trace(m_nodeIterators); |
| 5789 visitor->trace(m_ranges); | 5788 visitor->trace(m_ranges); |
| 5790 visitor->trace(m_styleEngine); | 5789 visitor->trace(m_styleEngine); |
| 5791 visitor->trace(m_formController); | 5790 visitor->trace(m_formController); |
| 5792 visitor->trace(m_visitedLinkState); | 5791 visitor->trace(m_visitedLinkState); |
| 5792 visitor->trace(m_frame); |
| 5793 visitor->trace(m_domWindow); | 5793 visitor->trace(m_domWindow); |
| 5794 visitor->trace(m_fetcher); | 5794 visitor->trace(m_fetcher); |
| 5795 visitor->trace(m_parser); | 5795 visitor->trace(m_parser); |
| 5796 visitor->trace(m_contextFeatures); | 5796 visitor->trace(m_contextFeatures); |
| 5797 visitor->trace(m_styleSheetList); | 5797 visitor->trace(m_styleSheetList); |
| 5798 visitor->trace(m_mediaQueryMatcher); | 5798 visitor->trace(m_mediaQueryMatcher); |
| 5799 visitor->trace(m_scriptedAnimationController); | 5799 visitor->trace(m_scriptedAnimationController); |
| 5800 visitor->trace(m_textAutosizer); | 5800 visitor->trace(m_textAutosizer); |
| 5801 visitor->trace(m_registrationContext); | 5801 visitor->trace(m_registrationContext); |
| 5802 visitor->trace(m_customElementMicrotaskRunQueue); | 5802 visitor->trace(m_customElementMicrotaskRunQueue); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5827 using namespace blink; | 5827 using namespace blink; |
| 5828 void showLiveDocumentInstances() | 5828 void showLiveDocumentInstances() |
| 5829 { | 5829 { |
| 5830 WeakDocumentSet& set = liveDocumentSet(); | 5830 WeakDocumentSet& set = liveDocumentSet(); |
| 5831 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5831 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5832 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 5832 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 5833 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 5833 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 5834 } | 5834 } |
| 5835 } | 5835 } |
| 5836 #endif | 5836 #endif |
| OLD | NEW |