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

Side by Side Diff: Source/core/inspector/InspectorTraceEvents.cpp

Issue 664033002: [Invalidation Tracking] Trace ScheduleStyleInvalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 2 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 | « Source/core/inspector/InspectorTraceEvents.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/inspector/InspectorTraceEvents.h" 6 #include "core/inspector/InspectorTraceEvents.h"
7 7
8 #include "bindings/core/v8/ScriptCallStackFactory.h" 8 #include "bindings/core/v8/ScriptCallStackFactory.h"
9 #include "bindings/core/v8/ScriptGCEvent.h" 9 #include "bindings/core/v8/ScriptGCEvent.h"
10 #include "bindings/core/v8/ScriptSourceCode.h" 10 #include "bindings/core/v8/ScriptSourceCode.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p))); 58 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p)));
59 } 59 }
60 60
61 void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const char* nameFieldName = 0) 61 void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const char* nameFieldName = 0)
62 { 62 {
63 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); 63 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node));
64 if (nameFieldName) 64 if (nameFieldName)
65 value->setString(nameFieldName, node->debugName()); 65 value->setString(nameFieldName, node->debugName());
66 } 66 }
67 67
68 const char* pseudoTypeToString(CSSSelector::PseudoType pseudoType)
69 {
70 switch (pseudoType) {
71 #define DEFINE_STRING_MAPPING(pseudoType) case CSSSelector::pseudoType: return # pseudoType;
72 DEFINE_STRING_MAPPING(PseudoNotParsed)
73 DEFINE_STRING_MAPPING(PseudoUnknown)
74 DEFINE_STRING_MAPPING(PseudoEmpty)
75 DEFINE_STRING_MAPPING(PseudoFirstChild)
76 DEFINE_STRING_MAPPING(PseudoFirstOfType)
77 DEFINE_STRING_MAPPING(PseudoLastChild)
78 DEFINE_STRING_MAPPING(PseudoLastOfType)
79 DEFINE_STRING_MAPPING(PseudoOnlyChild)
80 DEFINE_STRING_MAPPING(PseudoOnlyOfType)
81 DEFINE_STRING_MAPPING(PseudoFirstLine)
82 DEFINE_STRING_MAPPING(PseudoFirstLetter)
83 DEFINE_STRING_MAPPING(PseudoNthChild)
84 DEFINE_STRING_MAPPING(PseudoNthOfType)
85 DEFINE_STRING_MAPPING(PseudoNthLastChild)
86 DEFINE_STRING_MAPPING(PseudoNthLastOfType)
87 DEFINE_STRING_MAPPING(PseudoLink)
88 DEFINE_STRING_MAPPING(PseudoVisited)
89 DEFINE_STRING_MAPPING(PseudoAny)
90 DEFINE_STRING_MAPPING(PseudoAnyLink)
91 DEFINE_STRING_MAPPING(PseudoAutofill)
92 DEFINE_STRING_MAPPING(PseudoHover)
93 DEFINE_STRING_MAPPING(PseudoDrag)
94 DEFINE_STRING_MAPPING(PseudoFocus)
95 DEFINE_STRING_MAPPING(PseudoActive)
96 DEFINE_STRING_MAPPING(PseudoChecked)
97 DEFINE_STRING_MAPPING(PseudoEnabled)
98 DEFINE_STRING_MAPPING(PseudoFullPageMedia)
99 DEFINE_STRING_MAPPING(PseudoDefault)
100 DEFINE_STRING_MAPPING(PseudoDisabled)
101 DEFINE_STRING_MAPPING(PseudoOptional)
102 DEFINE_STRING_MAPPING(PseudoRequired)
103 DEFINE_STRING_MAPPING(PseudoReadOnly)
104 DEFINE_STRING_MAPPING(PseudoReadWrite)
105 DEFINE_STRING_MAPPING(PseudoValid)
106 DEFINE_STRING_MAPPING(PseudoInvalid)
107 DEFINE_STRING_MAPPING(PseudoIndeterminate)
108 DEFINE_STRING_MAPPING(PseudoTarget)
109 DEFINE_STRING_MAPPING(PseudoBefore)
110 DEFINE_STRING_MAPPING(PseudoAfter)
111 DEFINE_STRING_MAPPING(PseudoBackdrop)
112 DEFINE_STRING_MAPPING(PseudoLang)
113 DEFINE_STRING_MAPPING(PseudoNot)
114 DEFINE_STRING_MAPPING(PseudoResizer)
115 DEFINE_STRING_MAPPING(PseudoRoot)
116 DEFINE_STRING_MAPPING(PseudoScope)
117 DEFINE_STRING_MAPPING(PseudoScrollbar)
118 DEFINE_STRING_MAPPING(PseudoScrollbarButton)
119 DEFINE_STRING_MAPPING(PseudoScrollbarCorner)
120 DEFINE_STRING_MAPPING(PseudoScrollbarThumb)
121 DEFINE_STRING_MAPPING(PseudoScrollbarTrack)
122 DEFINE_STRING_MAPPING(PseudoScrollbarTrackPiece)
123 DEFINE_STRING_MAPPING(PseudoWindowInactive)
124 DEFINE_STRING_MAPPING(PseudoCornerPresent)
125 DEFINE_STRING_MAPPING(PseudoDecrement)
126 DEFINE_STRING_MAPPING(PseudoIncrement)
127 DEFINE_STRING_MAPPING(PseudoHorizontal)
128 DEFINE_STRING_MAPPING(PseudoVertical)
129 DEFINE_STRING_MAPPING(PseudoStart)
130 DEFINE_STRING_MAPPING(PseudoEnd)
131 DEFINE_STRING_MAPPING(PseudoDoubleButton)
132 DEFINE_STRING_MAPPING(PseudoSingleButton)
133 DEFINE_STRING_MAPPING(PseudoNoButton)
134 DEFINE_STRING_MAPPING(PseudoSelection)
135 DEFINE_STRING_MAPPING(PseudoLeftPage)
136 DEFINE_STRING_MAPPING(PseudoRightPage)
137 DEFINE_STRING_MAPPING(PseudoFirstPage)
138 DEFINE_STRING_MAPPING(PseudoFullScreen)
139 DEFINE_STRING_MAPPING(PseudoFullScreenDocument)
140 DEFINE_STRING_MAPPING(PseudoFullScreenAncestor)
141 DEFINE_STRING_MAPPING(PseudoInRange)
142 DEFINE_STRING_MAPPING(PseudoOutOfRange)
143 DEFINE_STRING_MAPPING(PseudoUserAgentCustomElement)
144 DEFINE_STRING_MAPPING(PseudoWebKitCustomElement)
145 DEFINE_STRING_MAPPING(PseudoCue)
146 DEFINE_STRING_MAPPING(PseudoFutureCue)
147 DEFINE_STRING_MAPPING(PseudoPastCue)
148 DEFINE_STRING_MAPPING(PseudoUnresolved)
149 DEFINE_STRING_MAPPING(PseudoContent)
150 DEFINE_STRING_MAPPING(PseudoHost)
151 DEFINE_STRING_MAPPING(PseudoHostContext)
152 DEFINE_STRING_MAPPING(PseudoShadow)
153 DEFINE_STRING_MAPPING(PseudoSpatialNavigationFocus)
154 DEFINE_STRING_MAPPING(PseudoListBox)
155 #undef DEFINE_STRING_MAPPING
156 }
157
158 ASSERT_NOT_REACHED();
159 return "";
160 }
161
68 } 162 }
69 163
164 PassRefPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::fillCom monPart(Element& element, const DescendantInvalidationSet& invalidationSet, cons t char* invalidatedSelector)
165 {
166 RefPtr<TracedValue> value = TracedValue::create();
167 value->setString("frame", toHexString(element.document().frame()));
168 setNodeInfo(value.get(), &element, "nodeId", "nodeName");
169 value->setString("invalidationSet", descendantInvalidationSetToIdString(inva lidationSet));
170 value->setString("InvalidatedSelectorId", invalidatedSelector);
171 if (RefPtrWillBeRawPtr<ScriptCallStack> stackTrace = createScriptCallStack(m axInvalidationTrackingCallstackSize, true))
172 value->setArray("stackTrace", stackTrace->buildInspectorArray()->asArray ());
173 return value.release();
174 }
175
176 const char InspectorScheduleStyleInvalidationTrackingEvent::Attribute[] = "attri bute";
177 const char InspectorScheduleStyleInvalidationTrackingEvent::Class[] = "class";
178 const char InspectorScheduleStyleInvalidationTrackingEvent::Id[] = "id";
179 const char InspectorScheduleStyleInvalidationTrackingEvent::Pseudo[] = "pseudo";
180
181 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::idChange(Element& element, const DescendantInvalidationSet& in validationSet, const AtomicString& id)
182 {
183 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id);
184 value->setString("changedId", id);
185 return value.release();
186 }
187
188 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::classChange(Element& element, const DescendantInvalidationSet& invalidationSet, const AtomicString& className)
189 {
190 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class);
191 value->setString("changedClass", className);
192 return value.release();
193 }
194
195 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::attributeChange(Element& element, const DescendantInvalidation Set& invalidationSet, const QualifiedName& attributeName)
196 {
197 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu te);
198 value->setString("changedAttribute", attributeName.toString());
199 return value.release();
200 }
201
202 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::pseudoChange(Element& element, const DescendantInvalidationSet & invalidationSet, CSSSelector::PseudoType pseudoType)
203 {
204 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu te);
205 value->setString("changedPseudo", pseudoTypeToString(pseudoType));
206 return value.release();
207 }
208
70 String descendantInvalidationSetToIdString(const DescendantInvalidationSet& set) 209 String descendantInvalidationSetToIdString(const DescendantInvalidationSet& set)
71 { 210 {
72 return toHexString(&set); 211 return toHexString(&set);
73 } 212 }
74 213
75 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati onList[] = "Element has pending invalidation list"; 214 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati onList[] = "Element has pending invalidation list";
76 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element."; 215 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element.";
77 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri bute[] = "Invalidation set matched attribute."; 216 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri bute[] = "Invalidation set matched attribute.";
78 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass [] = "Invalidation set matched class."; 217 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass [] = "Invalidation set matched class.";
79 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id."; 218 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id.";
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 607
469 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread) 608 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread)
470 { 609 {
471 RefPtr<TracedValue> value = TracedValue::create(); 610 RefPtr<TracedValue> value = TracedValue::create();
472 value->setString("sessionId", sessionId); 611 value->setString("sessionId", sessionId);
473 value->setDouble("workerThreadId", workerThread->platformThreadId()); 612 value->setDouble("workerThreadId", workerThread->platformThreadId());
474 return value.release(); 613 return value.release();
475 } 614 }
476 615
477 } 616 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTraceEvents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698