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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase past r181764 Created 6 years, 3 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 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 1779
1780 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can 1780 // Entering here from inside layout or paint would be catastrophic since rec alcStyle can
1781 // tear down the render tree or (unfortunately) run script. Kill the whole r enderer if 1781 // tear down the render tree or (unfortunately) run script. Kill the whole r enderer if
1782 // someone managed to get into here from inside layout or paint. 1782 // someone managed to get into here from inside layout or paint.
1783 RELEASE_ASSERT(!view()->isInPerformLayout()); 1783 RELEASE_ASSERT(!view()->isInPerformLayout());
1784 RELEASE_ASSERT(!view()->isPainting()); 1784 RELEASE_ASSERT(!view()->isPainting());
1785 1785
1786 // Script can run below in WidgetUpdates, so protect the LocalFrame. 1786 // Script can run below in WidgetUpdates, so protect the LocalFrame.
1787 // FIXME: Can this still happen? How does script run inside 1787 // FIXME: Can this still happen? How does script run inside
1788 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? 1788 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ?
1789 RefPtr<LocalFrame> protect(m_frame); 1789 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame);
1790 1790
1791 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree"); 1791 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree");
1792 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); 1792 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree");
1793 1793
1794 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC ount() on the resolver. 1794 // FIXME: Remove m_styleRecalcElementCounter, we should just use the accessC ount() on the resolver.
1795 m_styleRecalcElementCounter = 0; 1795 m_styleRecalcElementCounter = 0;
1796 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul ateStyles", "frame", frame()); 1796 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul ateStyles", "frame", frame());
1797 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 1797 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
1798 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 1798 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
1799 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc ulateStyle(this); 1799 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalc ulateStyle(this);
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after
4629 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e(); 4629 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e();
4630 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); 4630 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
4631 if (!m_documentTiming.domContentLoadedEventEnd) 4631 if (!m_documentTiming.domContentLoadedEventEnd)
4632 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( ); 4632 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( );
4633 4633
4634 // The loader's finishedParsing() method may invoke script that causes this object to 4634 // The loader's finishedParsing() method may invoke script that causes this object to
4635 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change). 4635 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
4636 // Keep it alive until we are done. 4636 // Keep it alive until we are done.
4637 RefPtrWillBeRawPtr<Document> protect(this); 4637 RefPtrWillBeRawPtr<Document> protect(this);
4638 4638
4639 if (RefPtr<LocalFrame> f = frame()) { 4639 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) {
4640 // Don't update the render tree if we haven't requested the main resourc e yet to avoid 4640 // Don't update the render tree if we haven't requested the main resourc e yet to avoid
4641 // adding extra latency. Note that the first render tree update can be e xpensive since it 4641 // adding extra latency. Note that the first render tree update can be e xpensive since it
4642 // triggers the parsing of the default stylesheets which are compiled-in . 4642 // triggers the parsing of the default stylesheets which are compiled-in .
4643 const bool mainResourceWasAlreadyRequested = 4643 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin e()->committedFirstRealDocumentLoad();
4644 m_frame->loader().stateMachine()->committedFirstRealDocumentLoad();
4645 4644
4646 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all 4645 // FrameLoader::finishedParsing() might end up calling Document::implici tClose() if all
4647 // resource loads are complete. HTMLObjectElements can start loading the ir resources from 4646 // resource loads are complete. HTMLObjectElements can start loading the ir resources from
4648 // post attach callbacks triggered by recalcStyle(). This means if we p arse out an <object> 4647 // post attach callbacks triggered by recalcStyle(). This means if we p arse out an <object>
4649 // tag and then reach the end of the document without updating styles, w e might not have yet 4648 // tag and then reach the end of the document without updating styles, w e might not have yet
4650 // started the resource load and might fire the window load event too ea rly. To avoid this 4649 // started the resource load and might fire the window load event too ea rly. To avoid this
4651 // we force the styles to be up to date before calling FrameLoader::fini shedParsing(). 4650 // we force the styles to be up to date before calling FrameLoader::fini shedParsing().
4652 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com ment 35. 4651 // See https://bugs.webkit.org/show_bug.cgi?id=36864 starting around com ment 35.
4653 if (mainResourceWasAlreadyRequested) 4652 if (mainResourceWasAlreadyRequested)
4654 updateRenderTreeIfNeeded(); 4653 updateRenderTreeIfNeeded();
4655 4654
4656 f->loader().finishedParsing(); 4655 frame->loader().finishedParsing();
4657 4656
4658 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Ma rkDOMContent", "data", InspectorMarkLoadEvent::data(f.get())); 4657 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Ma rkDOMContent", "data", InspectorMarkLoadEvent::data(frame.get()));
4659 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 4658 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
4660 InspectorInstrumentation::domContentLoadedEventFired(f.get()); 4659 InspectorInstrumentation::domContentLoadedEventFired(frame.get());
4661 } 4660 }
4662 4661
4663 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes 4662 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes
4664 // so that dynamically inserted content can also benefit from sharing optimi zations. 4663 // so that dynamically inserted content can also benefit from sharing optimi zations.
4665 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept 4664 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept
4666 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer. 4665 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer.
4667 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); 4666 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE);
4668 4667
4669 // Parser should have picked up all preloads by now 4668 // Parser should have picked up all preloads by now
4670 m_fetcher->clearPreloads(); 4669 m_fetcher->clearPreloads();
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
5829 using namespace blink; 5828 using namespace blink;
5830 void showLiveDocumentInstances() 5829 void showLiveDocumentInstances()
5831 { 5830 {
5832 WeakDocumentSet& set = liveDocumentSet(); 5831 WeakDocumentSet& set = liveDocumentSet();
5833 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5832 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5834 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5833 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5835 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5834 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5836 } 5835 }
5837 } 5836 }
5838 #endif 5837 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698