Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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", toHexString(&invalidationSet)); | |
| 170 value->setString("InvalidatedSelectorId", invalidatedSelector); | |
| 171 /* blocked on https://codereview.chromium.org/654013003/ | |
|
pdr.
2014/10/22 17:14:35
This should have landed now
kouhei (in TOK)
2014/10/23 03:23:32
Done.
| |
| 172 if (RefPtrWillBeRawPtr<ScriptCallStack> stackTrace = createScriptCallStack(m axInvalidationTrackingCallstackSize, true)) | |
| 173 value->setArray("stackTrace", stackTrace->buildInspectorArray()->asArray ()); | |
| 174 */ | |
| 175 return value.release(); | |
| 176 } | |
| 177 | |
| 178 const char InspectorScheduleStyleInvalidationTrackingEvent::Attribute[] = "attri bute"; | |
| 179 const char InspectorScheduleStyleInvalidationTrackingEvent::Class[] = "class"; | |
| 180 const char InspectorScheduleStyleInvalidationTrackingEvent::Id[] = "id"; | |
| 181 const char InspectorScheduleStyleInvalidationTrackingEvent::Pseudo[] = "pseudo"; | |
| 182 | |
| 183 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::idChange(Element& element, const DescendantInvalidationSet& in validationSet, const AtomicString& id) | |
| 184 { | |
| 185 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); | |
| 186 value->setString("changedId", id); | |
| 187 return value.release(); | |
| 188 } | |
| 189 | |
| 190 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::classChange(Element& element, const DescendantInvalidationSet& invalidationSet, const AtomicString& className) | |
| 191 { | |
| 192 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); | |
| 193 value->setString("changedClass", className); | |
| 194 return value.release(); | |
| 195 } | |
| 196 | |
| 197 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::attributeChange(Element& element, const DescendantInvalidation Set& invalidationSet, const QualifiedName& attributeName) | |
| 198 { | |
| 199 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu te); | |
| 200 value->setString("changedAttribute", attributeName.toString()); | |
| 201 return value.release(); | |
| 202 } | |
| 203 | |
| 204 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat ionTrackingEvent::pseudoChange(Element& element, const DescendantInvalidationSet & invalidationSet, CSSSelector::PseudoType pseudoType) | |
| 205 { | |
| 206 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu te); | |
| 207 value->setString("changedPseudo", pseudoTypeToString(pseudoType)); | |
| 208 return value.release(); | |
| 209 } | |
| 210 | |
| 70 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati onList[] = "Element has pending invalidation list"; | 211 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati onList[] = "Element has pending invalidation list"; |
| 71 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element."; | 212 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element."; |
| 72 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri bute[] = "Invalidation set matched attribute."; | 213 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri bute[] = "Invalidation set matched attribute."; |
| 73 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass [] = "Invalidation set matched class."; | 214 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass [] = "Invalidation set matched class."; |
| 74 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id."; | 215 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id."; |
| 75 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa me[] = "Invalidation set matched tagName."; | 216 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa me[] = "Invalidation set matched tagName."; |
| 76 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen t[] = "Prevent style sharing for parent."; | 217 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen t[] = "Prevent style sharing for parent."; |
| 77 | 218 |
| 78 PassRefPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::fillCommonPart (Element& element, const char* reason) | 219 PassRefPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::fillCommonPart (Element& element, const char* reason) |
| 79 { | 220 { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 602 |
| 462 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread) | 603 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread) |
| 463 { | 604 { |
| 464 RefPtr<TracedValue> value = TracedValue::create(); | 605 RefPtr<TracedValue> value = TracedValue::create(); |
| 465 value->setString("sessionId", sessionId); | 606 value->setString("sessionId", sessionId); |
| 466 value->setDouble("workerThreadId", workerThread->platformThreadId()); | 607 value->setDouble("workerThreadId", workerThread->platformThreadId()); |
| 467 return value.release(); | 608 return value.release(); |
| 468 } | 609 } |
| 469 | 610 |
| 470 } | 611 } |
| OLD | NEW |