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

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 889823002: Remove TRACE_EVENT indirection through blink::Platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « sky/engine/core/core.gni ('k') | sky/engine/core/dom/Node.cpp » ('j') | 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 #include "sky/engine/core/html/imports/HTMLImportChild.h" 102 #include "sky/engine/core/html/imports/HTMLImportChild.h"
103 #include "sky/engine/core/html/imports/HTMLImportLoader.h" 103 #include "sky/engine/core/html/imports/HTMLImportLoader.h"
104 #include "sky/engine/core/html/imports/HTMLImportTreeRoot.h" 104 #include "sky/engine/core/html/imports/HTMLImportTreeRoot.h"
105 #include "sky/engine/core/html/imports/HTMLImportsController.h" 105 #include "sky/engine/core/html/imports/HTMLImportsController.h"
106 #include "sky/engine/core/html/parser/HTMLDocumentParser.h" 106 #include "sky/engine/core/html/parser/HTMLDocumentParser.h"
107 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" 107 #include "sky/engine/core/html/parser/HTMLParserIdioms.h"
108 #include "sky/engine/core/html/parser/NestingLevelIncrementer.h" 108 #include "sky/engine/core/html/parser/NestingLevelIncrementer.h"
109 #include "sky/engine/core/html/parser/TextResourceDecoder.h" 109 #include "sky/engine/core/html/parser/TextResourceDecoder.h"
110 #include "sky/engine/core/inspector/ConsoleMessage.h" 110 #include "sky/engine/core/inspector/ConsoleMessage.h"
111 #include "sky/engine/core/inspector/InspectorCounters.h" 111 #include "sky/engine/core/inspector/InspectorCounters.h"
112 #include "sky/engine/core/inspector/InspectorTraceEvents.h"
113 #include "sky/engine/core/loader/FrameLoaderClient.h" 112 #include "sky/engine/core/loader/FrameLoaderClient.h"
114 #include "sky/engine/core/loader/ImageLoader.h" 113 #include "sky/engine/core/loader/ImageLoader.h"
115 #include "sky/engine/core/page/ChromeClient.h" 114 #include "sky/engine/core/page/ChromeClient.h"
116 #include "sky/engine/core/page/EventHandler.h" 115 #include "sky/engine/core/page/EventHandler.h"
117 #include "sky/engine/core/page/FocusController.h" 116 #include "sky/engine/core/page/FocusController.h"
118 #include "sky/engine/core/page/Page.h" 117 #include "sky/engine/core/page/Page.h"
119 #include "sky/engine/core/rendering/HitTestResult.h" 118 #include "sky/engine/core/rendering/HitTestResult.h"
120 #include "sky/engine/core/rendering/RenderView.h" 119 #include "sky/engine/core/rendering/RenderView.h"
121 #include "sky/engine/platform/DateComponents.h" 120 #include "sky/engine/platform/DateComponents.h"
122 #include "sky/engine/platform/EventDispatchForbiddenScope.h" 121 #include "sky/engine/platform/EventDispatchForbiddenScope.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 { 925 {
927 ASSERT(!hasPendingStyleRecalc()); 926 ASSERT(!hasPendingStyleRecalc());
928 ASSERT(shouldScheduleRenderTreeUpdate()); 927 ASSERT(shouldScheduleRenderTreeUpdate());
929 ASSERT(needsRenderTreeUpdate()); 928 ASSERT(needsRenderTreeUpdate());
930 929
931 scheduleVisualUpdate(); 930 scheduleVisualUpdate();
932 931
933 // TODO(esprehn): We should either rename this state, or change the other 932 // TODO(esprehn): We should either rename this state, or change the other
934 // users of scheduleVisualUpdate() so they don't expect different states. 933 // users of scheduleVisualUpdate() so they don't expect different states.
935 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); 934 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending);
936
937 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Schedu leStyleRecalculation", TRACE_EVENT_SCOPE_PROCESS, "frame", frame());
938 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
939 } 935 }
940 936
941 void Document::scheduleVisualUpdate() 937 void Document::scheduleVisualUpdate()
942 { 938 {
943 page()->animator().scheduleVisualUpdate(); 939 page()->animator().scheduleVisualUpdate();
944 } 940 }
945 941
946 void Document::updateDistributionIfNeeded() 942 void Document::updateDistributionIfNeeded()
947 { 943 {
948 ScriptForbiddenScope forbidScript; 944 ScriptForbiddenScope forbidScript;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 997
1002 // Script can run below in WidgetUpdates, so protect the LocalFrame. 998 // Script can run below in WidgetUpdates, so protect the LocalFrame.
1003 // FIXME: Can this still happen? How does script run inside 999 // FIXME: Can this still happen? How does script run inside
1004 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ? 1000 // UpdateSuspendScope::performDeferredWidgetTreeOperations() ?
1005 RefPtr<LocalFrame> protect(m_frame); 1001 RefPtr<LocalFrame> protect(m_frame);
1006 1002
1007 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree"); 1003 TRACE_EVENT_BEGIN0("blink", "Document::updateRenderTree");
1008 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree"); 1004 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "UpdateRenderTree");
1009 1005
1010 m_styleRecalcElementCounter = 0; 1006 m_styleRecalcElementCounter = 0;
1011 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalcul ateStyles", "frame", frame());
1012 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
1013 1007
1014 DocumentAnimations::updateOutdatedAnimationPlayersIfNeeded(*this); 1008 DocumentAnimations::updateOutdatedAnimationPlayersIfNeeded(*this);
1015 evaluateMediaQueryListIfNeeded(); 1009 evaluateMediaQueryListIfNeeded();
1016 updateDistributionIfNeeded(); 1010 updateDistributionIfNeeded();
1017 1011
1018 // FIXME: We should update style on our ancestor chain before proceeding 1012 // FIXME: We should update style on our ancestor chain before proceeding
1019 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach 1013 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach
1020 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn 1014 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn
1021 // resolves style (here) and then when we resolve style on the parent chain, we may end up 1015 // resolves style (here) and then when we resolve style on the parent chain, we may end up
1022 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed 1016 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed
1023 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. 1017 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
1024 1018
1025 updateStyle(change); 1019 updateStyle(change);
1026 1020
1027 if (m_focusedElement && !m_focusedElement->isFocusable()) 1021 if (m_focusedElement && !m_focusedElement->isFocusable())
1028 clearFocusedElementSoon(); 1022 clearFocusedElementSoon();
1029 1023
1030 ASSERT(!m_timeline->hasOutdatedAnimationPlayer()); 1024 ASSERT(!m_timeline->hasOutdatedAnimationPlayer());
1031
1032 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Recalculat eStyles", "elementCount", m_styleRecalcElementCounter);
1033 TRACE_EVENT_END1("blink", "Document::updateRenderTree", "elementCount", m_st yleRecalcElementCounter);
1034 } 1025 }
1035 1026
1036 void Document::updateStyle(StyleRecalcChange change) 1027 void Document::updateStyle(StyleRecalcChange change)
1037 { 1028 {
1038 TRACE_EVENT0("blink", "Document::updateStyle"); 1029 TRACE_EVENT0("blink", "Document::updateStyle");
1039 1030
1040 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); 1031 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
1041 1032
1042 if (styleChangeType() >= SubtreeStyleChange) 1033 if (styleChangeType() >= SubtreeStyleChange)
1043 change = Force; 1034 change = Force;
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 ASSERT(!m_parser || !m_parser->isParsing()); 2037 ASSERT(!m_parser || !m_parser->isParsing());
2047 ASSERT(!m_parser || m_readyState != Loading); 2038 ASSERT(!m_parser || m_readyState != Loading);
2048 setParsing(false); 2039 setParsing(false);
2049 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); 2040 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
2050 2041
2051 // The loader's finishedParsing() method may invoke script that causes this object to 2042 // The loader's finishedParsing() method may invoke script that causes this object to
2052 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change). 2043 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
2053 // Keep it alive until we are done. 2044 // Keep it alive until we are done.
2054 RefPtr<Document> protect(this); 2045 RefPtr<Document> protect(this);
2055 2046
2056 if (RefPtr<LocalFrame> f = frame()) { 2047 if (RefPtr<LocalFrame> f = frame())
2057 checkCompleted(); 2048 checkCompleted();
2058 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Ma rkDOMContent", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorMarkLoadEvent::data() );
2059 }
2060 2049
2061 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes 2050 // Schedule dropping of the ElementDataCache. We keep it alive for a while a fter parsing finishes
2062 // so that dynamically inserted content can also benefit from sharing optimi zations. 2051 // so that dynamically inserted content can also benefit from sharing optimi zations.
2063 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept 2052 // Note that we don't refresh the timer on cache access since that could lea d to huge caches being kept
2064 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer. 2053 // alive indefinitely by something innocuous like JS setting .innerHTML repe atedly on a timer.
2065 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); 2054 m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE);
2066 2055
2067 if (HTMLImportLoader* import = importLoader()) 2056 if (HTMLImportLoader* import = importLoader())
2068 import->didFinishParsing(); 2057 import->didFinishParsing();
2069 } 2058 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2294 using namespace blink; 2283 using namespace blink;
2295 void showLiveDocumentInstances() 2284 void showLiveDocumentInstances()
2296 { 2285 {
2297 WeakDocumentSet& set = liveDocumentSet(); 2286 WeakDocumentSet& set = liveDocumentSet();
2298 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2287 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2299 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2288 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2300 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2289 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2301 } 2290 }
2302 } 2291 }
2303 #endif 2292 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/core.gni ('k') | sky/engine/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698