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 unsigned long identifier, | 111 unsigned long identifier, |
112 DocumentLoader*, | 112 DocumentLoader* loader, |
113 ResourceRequest& request, | 113 ResourceRequest& request, |
114 const ResourceResponse& redirect_response, | 114 const ResourceResponse& redirect_response, |
115 const FetchInitiatorInfo&) { | 115 const FetchInitiatorInfo&) { |
| 116 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
116 TRACE_EVENT_INSTANT1( | 117 TRACE_EVENT_INSTANT1( |
117 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, | 118 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, |
118 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); | 119 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); |
119 probe::AsyncTaskScheduled(frame->GetDocument(), "SendRequest", | 120 probe::AsyncTaskScheduled(frame ? frame->GetDocument() : nullptr, |
120 AsyncId(identifier)); | 121 "SendRequest", AsyncId(identifier)); |
121 } | 122 } |
122 | 123 |
123 void InspectorTraceEvents::DidReceiveResourceResponse( | 124 void InspectorTraceEvents::DidReceiveResourceResponse( |
124 LocalFrame* frame, | |
125 unsigned long identifier, | 125 unsigned long identifier, |
126 DocumentLoader*, | 126 DocumentLoader* loader, |
127 const ResourceResponse& response, | 127 const ResourceResponse& response, |
128 Resource*) { | 128 Resource*) { |
| 129 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
129 TRACE_EVENT_INSTANT1( | 130 TRACE_EVENT_INSTANT1( |
130 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, | 131 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, |
131 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); | 132 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); |
132 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 133 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
133 "response"); | 134 AsyncId(identifier), "response"); |
134 } | 135 } |
135 | 136 |
136 void InspectorTraceEvents::DidReceiveData(LocalFrame* frame, | 137 void InspectorTraceEvents::DidReceiveData(unsigned long identifier, |
137 unsigned long identifier, | 138 DocumentLoader* loader, |
138 const char* data, | 139 const char* data, |
139 int encoded_data_length) { | 140 int encoded_data_length) { |
| 141 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
140 TRACE_EVENT_INSTANT1( | 142 TRACE_EVENT_INSTANT1( |
141 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, | 143 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, |
142 "data", | 144 "data", |
143 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); | 145 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); |
144 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 146 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
145 "data"); | 147 AsyncId(identifier), "data"); |
146 } | 148 } |
147 | 149 |
148 void InspectorTraceEvents::DidFinishLoading(LocalFrame* frame, | 150 void InspectorTraceEvents::DidFinishLoading(unsigned long identifier, |
149 unsigned long identifier, | 151 DocumentLoader* loader, |
150 double finish_time, | 152 double finish_time, |
151 int64_t encoded_data_length, | 153 int64_t encoded_data_length, |
152 int64_t decoded_body_length) { | 154 int64_t decoded_body_length) { |
| 155 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
153 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", | 156 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", |
154 TRACE_EVENT_SCOPE_THREAD, "data", | 157 TRACE_EVENT_SCOPE_THREAD, "data", |
155 InspectorResourceFinishEvent::Data( | 158 InspectorResourceFinishEvent::Data( |
156 identifier, finish_time, false, encoded_data_length, | 159 identifier, finish_time, false, encoded_data_length, |
157 decoded_body_length)); | 160 decoded_body_length)); |
158 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier)); | 161 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
| 162 AsyncId(identifier)); |
159 } | 163 } |
160 | 164 |
161 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, | 165 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, |
162 const ResourceError&) { | 166 const ResourceError&) { |
163 TRACE_EVENT_INSTANT1( | 167 TRACE_EVENT_INSTANT1( |
164 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", | 168 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", |
165 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); | 169 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); |
166 } | 170 } |
167 | 171 |
168 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} | 172 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 return value; | 1217 return value; |
1214 } | 1218 } |
1215 | 1219 |
1216 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { | 1220 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { |
1217 std::unique_ptr<TracedValue> value = TracedValue::Create(); | 1221 std::unique_ptr<TracedValue> value = TracedValue::Create(); |
1218 value->SetString("name", name); | 1222 value->SetString("name", name); |
1219 return value; | 1223 return value; |
1220 } | 1224 } |
1221 | 1225 |
1222 } // namespace blink | 1226 } // namespace blink |
OLD | NEW |