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 "core/inspector/InspectorTraceEvents.h" | 5 #include "core/inspector/InspectorTraceEvents.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "bindings/core/v8/ScriptSourceCode.h" | 11 #include "bindings/core/v8/ScriptSourceCode.h" |
12 #include "bindings/core/v8/SourceLocation.h" | 12 #include "bindings/core/v8/SourceLocation.h" |
13 #include "core/animation/Animation.h" | 13 #include "core/animation/Animation.h" |
14 #include "core/animation/KeyframeEffectReadOnly.h" | 14 #include "core/animation/KeyframeEffectReadOnly.h" |
15 #include "core/css/invalidation/InvalidationSet.h" | 15 #include "core/css/invalidation/InvalidationSet.h" |
16 #include "core/dom/DOMNodeIds.h" | 16 #include "core/dom/DOMNodeIds.h" |
17 #include "core/dom/StyleChangeReason.h" | 17 #include "core/dom/StyleChangeReason.h" |
18 #include "core/events/Event.h" | 18 #include "core/events/Event.h" |
19 #include "core/frame/FrameView.h" | 19 #include "core/frame/FrameView.h" |
20 #include "core/frame/LocalFrame.h" | 20 #include "core/frame/LocalFrame.h" |
21 #include "core/html/HTMLFrameOwnerElement.h" | 21 #include "core/html/HTMLFrameOwnerElement.h" |
22 #include "core/html/parser/HTMLDocumentParser.h" | 22 #include "core/html/parser/HTMLDocumentParser.h" |
23 #include "core/inspector/IdentifiersFactory.h" | 23 #include "core/inspector/IdentifiersFactory.h" |
24 #include "core/layout/HitTestResult.h" | 24 #include "core/layout/HitTestResult.h" |
25 #include "core/layout/LayoutImage.h" | 25 #include "core/layout/LayoutImage.h" |
26 #include "core/layout/LayoutObject.h" | 26 #include "core/layout/LayoutObject.h" |
| 27 #include "core/loader/DocumentLoader.h" |
27 #include "core/loader/resource/CSSStyleSheetResource.h" | 28 #include "core/loader/resource/CSSStyleSheetResource.h" |
28 #include "core/page/Page.h" | 29 #include "core/page/Page.h" |
29 #include "core/paint/PaintLayer.h" | 30 #include "core/paint/PaintLayer.h" |
30 #include "core/probe/CoreProbes.h" | 31 #include "core/probe/CoreProbes.h" |
31 #include "core/workers/WorkerGlobalScope.h" | 32 #include "core/workers/WorkerGlobalScope.h" |
32 #include "core/workers/WorkerThread.h" | 33 #include "core/workers/WorkerThread.h" |
33 #include "core/xmlhttprequest/XMLHttpRequest.h" | 34 #include "core/xmlhttprequest/XMLHttpRequest.h" |
34 #include "platform/InstanceCounters.h" | 35 #include "platform/InstanceCounters.h" |
35 #include "platform/graphics/GraphicsLayer.h" | 36 #include "platform/graphics/GraphicsLayer.h" |
36 #include "platform/instrumentation/tracing/TracedValue.h" | 37 #include "platform/instrumentation/tracing/TracedValue.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 instrumenting_agents_->removeInspectorTraceEvents(this); | 101 instrumenting_agents_->removeInspectorTraceEvents(this); |
101 instrumenting_agents_ = nullptr; | 102 instrumenting_agents_ = nullptr; |
102 } | 103 } |
103 | 104 |
104 DEFINE_TRACE(InspectorTraceEvents) { | 105 DEFINE_TRACE(InspectorTraceEvents) { |
105 visitor->Trace(instrumenting_agents_); | 106 visitor->Trace(instrumenting_agents_); |
106 InspectorAgent::Trace(visitor); | 107 InspectorAgent::Trace(visitor); |
107 } | 108 } |
108 | 109 |
109 void InspectorTraceEvents::WillSendRequest( | 110 void InspectorTraceEvents::WillSendRequest( |
110 LocalFrame* frame, | 111 ExecutionContext*, |
111 unsigned long identifier, | 112 unsigned long identifier, |
112 DocumentLoader*, | 113 DocumentLoader* loader, |
113 ResourceRequest& request, | 114 ResourceRequest& request, |
114 const ResourceResponse& redirect_response, | 115 const ResourceResponse& redirect_response, |
115 const FetchInitiatorInfo&) { | 116 const FetchInitiatorInfo&) { |
| 117 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
116 TRACE_EVENT_INSTANT1( | 118 TRACE_EVENT_INSTANT1( |
117 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, | 119 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, |
118 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); | 120 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); |
119 probe::AsyncTaskScheduled(frame->GetDocument(), "SendRequest", | 121 probe::AsyncTaskScheduled(frame ? frame->GetDocument() : nullptr, |
120 AsyncId(identifier)); | 122 "SendRequest", AsyncId(identifier)); |
121 } | 123 } |
122 | 124 |
123 void InspectorTraceEvents::DidReceiveResourceResponse( | 125 void InspectorTraceEvents::DidReceiveResourceResponse( |
124 LocalFrame* frame, | |
125 unsigned long identifier, | 126 unsigned long identifier, |
126 DocumentLoader*, | 127 DocumentLoader* loader, |
127 const ResourceResponse& response, | 128 const ResourceResponse& response, |
128 Resource*) { | 129 Resource*) { |
| 130 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
129 TRACE_EVENT_INSTANT1( | 131 TRACE_EVENT_INSTANT1( |
130 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, | 132 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, |
131 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); | 133 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); |
132 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 134 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
133 "response"); | 135 AsyncId(identifier), "response"); |
134 } | 136 } |
135 | 137 |
136 void InspectorTraceEvents::DidReceiveData(LocalFrame* frame, | 138 void InspectorTraceEvents::DidReceiveData(unsigned long identifier, |
137 unsigned long identifier, | 139 DocumentLoader* loader, |
138 const char* data, | 140 const char* data, |
139 int encoded_data_length) { | 141 int encoded_data_length) { |
| 142 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
140 TRACE_EVENT_INSTANT1( | 143 TRACE_EVENT_INSTANT1( |
141 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, | 144 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, |
142 "data", | 145 "data", |
143 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); | 146 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); |
144 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 147 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
145 "data"); | 148 AsyncId(identifier), "data"); |
146 } | 149 } |
147 | 150 |
148 void InspectorTraceEvents::DidFinishLoading(LocalFrame* frame, | 151 void InspectorTraceEvents::DidFinishLoading(unsigned long identifier, |
149 unsigned long identifier, | 152 DocumentLoader* loader, |
150 double finish_time, | 153 double finish_time, |
151 int64_t encoded_data_length, | 154 int64_t encoded_data_length, |
152 int64_t decoded_body_length) { | 155 int64_t decoded_body_length) { |
| 156 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
153 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", | 157 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", |
154 TRACE_EVENT_SCOPE_THREAD, "data", | 158 TRACE_EVENT_SCOPE_THREAD, "data", |
155 InspectorResourceFinishEvent::Data( | 159 InspectorResourceFinishEvent::Data( |
156 identifier, finish_time, false, encoded_data_length, | 160 identifier, finish_time, false, encoded_data_length, |
157 decoded_body_length)); | 161 decoded_body_length)); |
158 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier)); | 162 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
| 163 AsyncId(identifier)); |
159 } | 164 } |
160 | 165 |
161 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, | 166 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, |
162 const ResourceError&) { | 167 const ResourceError&) { |
163 TRACE_EVENT_INSTANT1( | 168 TRACE_EVENT_INSTANT1( |
164 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", | 169 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", |
165 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); | 170 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); |
166 } | 171 } |
167 | 172 |
168 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} | 173 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 return value; | 1218 return value; |
1214 } | 1219 } |
1215 | 1220 |
1216 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { | 1221 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { |
1217 std::unique_ptr<TracedValue> value = TracedValue::Create(); | 1222 std::unique_ptr<TracedValue> value = TracedValue::Create(); |
1218 value->SetString("name", name); | 1223 value->SetString("name", name); |
1219 return value; | 1224 return value; |
1220 } | 1225 } |
1221 | 1226 |
1222 } // namespace blink | 1227 } // namespace blink |
OLD | NEW |