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" |
11 #include "core/css/invalidation/DescendantInvalidationSet.h" | |
12 #include "core/dom/StyleChangeReason.h" | 11 #include "core/dom/StyleChangeReason.h" |
13 #include "core/events/Event.h" | 12 #include "core/events/Event.h" |
14 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
15 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
16 #include "core/inspector/IdentifiersFactory.h" | 15 #include "core/inspector/IdentifiersFactory.h" |
17 #include "core/inspector/InspectorNodeIds.h" | 16 #include "core/inspector/InspectorNodeIds.h" |
18 #include "core/inspector/ScriptCallStack.h" | 17 #include "core/inspector/ScriptCallStack.h" |
19 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
20 #include "core/rendering/RenderImage.h" | 19 #include "core/rendering/RenderImage.h" |
21 #include "core/rendering/RenderLayer.h" | 20 #include "core/rendering/RenderLayer.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 59 |
61 void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const
char* nameFieldName = 0) | 60 void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const
char* nameFieldName = 0) |
62 { | 61 { |
63 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); | 62 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); |
64 if (nameFieldName) | 63 if (nameFieldName) |
65 value->setString(nameFieldName, node->debugName()); | 64 value->setString(nameFieldName, node->debugName()); |
66 } | 65 } |
67 | 66 |
68 } | 67 } |
69 | 68 |
70 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati
onList[] = "Element has pending invalidation list"; | |
71 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] =
"Invalidate custom pseudo element."; | |
72 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri
bute[] = "Invalidation set matched attribute."; | |
73 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass
[] = "Invalidation set matched class."; | |
74 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[]
= "Invalidation set matched id."; | |
75 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa
me[] = "Invalidation set matched tagName."; | |
76 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen
t[] = "Prevent style sharing for parent."; | |
77 | |
78 PassRefPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::fillCommonPart
(Element& element, const char* reason) | |
79 { | |
80 RefPtr<TracedValue> value = TracedValue::create(); | |
81 value->setString("frame", toHexString(element.document().frame())); | |
82 setNodeInfo(value.get(), &element, "nodeId", "nodeName"); | |
83 value->setString("reason", reason); | |
84 return value.release(); | |
85 } | |
86 | |
87 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::data(Element& element, const char* reason) | |
88 { | |
89 return fillCommonPart(element, reason); | |
90 } | |
91 | |
92 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::selectorPart(Element& element, const char* reason, const String& sele
ctorPart) | |
93 { | |
94 RefPtr<TracedValue> value = fillCommonPart(element, reason); | |
95 value->setString("selectorPart", selectorPart); | |
96 return value.release(); | |
97 } | |
98 | |
99 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::invalidationList(Element& element, const WillBeHeapVector<RefPtrWillB
eMember<DescendantInvalidationSet> >& invalidationList) | |
100 { | |
101 RefPtr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalid
ationList); | |
102 value->beginArray("invalidationList"); | |
103 for (const auto& invalidationSet : invalidationList) | |
104 invalidationSet->toTracedValue(value.get()); | |
105 value->endArray(); | |
106 return value.release(); | |
107 } | |
108 | |
109 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleRecalcInvalidatio
nTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) | 69 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleRecalcInvalidatio
nTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) |
110 { | 70 { |
111 ASSERT(node); | 71 ASSERT(node); |
112 | 72 |
113 RefPtr<TracedValue> value = TracedValue::create(); | 73 RefPtr<TracedValue> value = TracedValue::create(); |
114 value->setString("frame", toHexString(node->document().frame())); | 74 value->setString("frame", toHexString(node->document().frame())); |
115 setNodeInfo(value.get(), node, "nodeId", "nodeName"); | 75 setNodeInfo(value.get(), node, "nodeId", "nodeName"); |
116 value->setString("reason", reason.reasonString()); | 76 value->setString("reason", reason.reasonString()); |
117 value->setString("extraData", reason.extraData()); | 77 value->setString("extraData", reason.extraData()); |
118 return value.release(); | 78 return value.release(); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 421 |
462 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor
kerEvent::data(const String& sessionId, WorkerThread* workerThread) | 422 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor
kerEvent::data(const String& sessionId, WorkerThread* workerThread) |
463 { | 423 { |
464 RefPtr<TracedValue> value = TracedValue::create(); | 424 RefPtr<TracedValue> value = TracedValue::create(); |
465 value->setString("sessionId", sessionId); | 425 value->setString("sessionId", sessionId); |
466 value->setDouble("workerThreadId", workerThread->platformThreadId()); | 426 value->setDouble("workerThreadId", workerThread->platformThreadId()); |
467 return value.release(); | 427 return value.release(); |
468 } | 428 } |
469 | 429 |
470 } | 430 } |
OLD | NEW |