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/LocalFrame.h" | 19 #include "core/frame/LocalFrame.h" |
20 #include "core/frame/LocalFrameView.h" | 20 #include "core/frame/LocalFrameView.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 instrumenting_agents_->removeInspectorTraceEvents(this); | 102 instrumenting_agents_->removeInspectorTraceEvents(this); |
102 instrumenting_agents_ = nullptr; | 103 instrumenting_agents_ = nullptr; |
103 } | 104 } |
104 | 105 |
105 DEFINE_TRACE(InspectorTraceEvents) { | 106 DEFINE_TRACE(InspectorTraceEvents) { |
106 visitor->Trace(instrumenting_agents_); | 107 visitor->Trace(instrumenting_agents_); |
107 InspectorAgent::Trace(visitor); | 108 InspectorAgent::Trace(visitor); |
108 } | 109 } |
109 | 110 |
110 void InspectorTraceEvents::WillSendRequest( | 111 void InspectorTraceEvents::WillSendRequest( |
111 LocalFrame* frame, | 112 ExecutionContext*, |
112 unsigned long identifier, | 113 unsigned long identifier, |
113 DocumentLoader*, | 114 DocumentLoader* loader, |
114 ResourceRequest& request, | 115 ResourceRequest& request, |
115 const ResourceResponse& redirect_response, | 116 const ResourceResponse& redirect_response, |
116 const FetchInitiatorInfo&) { | 117 const FetchInitiatorInfo&) { |
| 118 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
117 TRACE_EVENT_INSTANT1( | 119 TRACE_EVENT_INSTANT1( |
118 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, | 120 "devtools.timeline", "ResourceSendRequest", TRACE_EVENT_SCOPE_THREAD, |
119 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); | 121 "data", InspectorSendRequestEvent::Data(identifier, frame, request)); |
120 probe::AsyncTaskScheduled(frame->GetDocument(), "SendRequest", | 122 probe::AsyncTaskScheduled(frame ? frame->GetDocument() : nullptr, |
121 AsyncId(identifier)); | 123 "SendRequest", AsyncId(identifier)); |
122 } | 124 } |
123 | 125 |
124 void InspectorTraceEvents::DidReceiveResourceResponse( | 126 void InspectorTraceEvents::DidReceiveResourceResponse( |
125 LocalFrame* frame, | |
126 unsigned long identifier, | 127 unsigned long identifier, |
127 DocumentLoader*, | 128 DocumentLoader* loader, |
128 const ResourceResponse& response, | 129 const ResourceResponse& response, |
129 Resource*) { | 130 Resource*) { |
| 131 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
130 TRACE_EVENT_INSTANT1( | 132 TRACE_EVENT_INSTANT1( |
131 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, | 133 "devtools.timeline", "ResourceReceiveResponse", TRACE_EVENT_SCOPE_THREAD, |
132 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); | 134 "data", InspectorReceiveResponseEvent::Data(identifier, frame, response)); |
133 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 135 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
134 "response"); | 136 AsyncId(identifier), "response"); |
135 } | 137 } |
136 | 138 |
137 void InspectorTraceEvents::DidReceiveData(LocalFrame* frame, | 139 void InspectorTraceEvents::DidReceiveData(unsigned long identifier, |
138 unsigned long identifier, | 140 DocumentLoader* loader, |
139 const char* data, | 141 const char* data, |
140 int encoded_data_length) { | 142 int encoded_data_length) { |
| 143 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
141 TRACE_EVENT_INSTANT1( | 144 TRACE_EVENT_INSTANT1( |
142 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, | 145 "devtools.timeline", "ResourceReceivedData", TRACE_EVENT_SCOPE_THREAD, |
143 "data", | 146 "data", |
144 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); | 147 InspectorReceiveDataEvent::Data(identifier, frame, encoded_data_length)); |
145 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier), | 148 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
146 "data"); | 149 AsyncId(identifier), "data"); |
147 } | 150 } |
148 | 151 |
149 void InspectorTraceEvents::DidFinishLoading(LocalFrame* frame, | 152 void InspectorTraceEvents::DidFinishLoading(unsigned long identifier, |
150 unsigned long identifier, | 153 DocumentLoader* loader, |
151 double finish_time, | 154 double finish_time, |
152 int64_t encoded_data_length, | 155 int64_t encoded_data_length, |
153 int64_t decoded_body_length) { | 156 int64_t decoded_body_length) { |
| 157 LocalFrame* frame = loader ? loader->GetFrame() : nullptr; |
154 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", | 158 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", |
155 TRACE_EVENT_SCOPE_THREAD, "data", | 159 TRACE_EVENT_SCOPE_THREAD, "data", |
156 InspectorResourceFinishEvent::Data( | 160 InspectorResourceFinishEvent::Data( |
157 identifier, finish_time, false, encoded_data_length, | 161 identifier, finish_time, false, encoded_data_length, |
158 decoded_body_length)); | 162 decoded_body_length)); |
159 probe::AsyncTask async_task(frame->GetDocument(), AsyncId(identifier)); | 163 probe::AsyncTask async_task(frame ? frame->GetDocument() : nullptr, |
| 164 AsyncId(identifier)); |
160 } | 165 } |
161 | 166 |
162 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, | 167 void InspectorTraceEvents::DidFailLoading(unsigned long identifier, |
163 const ResourceError&) { | 168 const ResourceError&) { |
164 TRACE_EVENT_INSTANT1( | 169 TRACE_EVENT_INSTANT1( |
165 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", | 170 "devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOPE_THREAD, "data", |
166 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); | 171 InspectorResourceFinishEvent::Data(identifier, 0, true, 0, 0)); |
167 } | 172 } |
168 | 173 |
169 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} | 174 void InspectorTraceEvents::Will(const probe::ExecuteScript&) {} |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 return value; | 1230 return value; |
1226 } | 1231 } |
1227 | 1232 |
1228 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { | 1233 std::unique_ptr<TracedValue> InspectorAsyncTask::Data(const String& name) { |
1229 std::unique_ptr<TracedValue> value = TracedValue::Create(); | 1234 std::unique_ptr<TracedValue> value = TracedValue::Create(); |
1230 value->SetString("name", name); | 1235 value->SetString("name", name); |
1231 return value; | 1236 return value; |
1232 } | 1237 } |
1233 | 1238 |
1234 } // namespace blink | 1239 } // namespace blink |
OLD | NEW |