Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/core/inspector/InspectorTraceEvents.cpp

Issue 308123008: DevTools: added support for image url & node in tracing-based timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: skip check for presence of endData in Layout Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorTraceEvents.h ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8/ScriptCallStackFactory.h" 8 #include "bindings/v8/ScriptCallStackFactory.h"
9 #include "bindings/v8/ScriptGCEvent.h" 9 #include "bindings/v8/ScriptGCEvent.h"
10 #include "bindings/v8/ScriptSourceCode.h" 10 #include "bindings/v8/ScriptSourceCode.h"
11 #include "core/frame/FrameView.h" 11 #include "core/frame/FrameView.h"
12 #include "core/frame/LocalFrame.h" 12 #include "core/frame/LocalFrame.h"
13 #include "core/inspector/IdentifiersFactory.h" 13 #include "core/inspector/IdentifiersFactory.h"
14 #include "core/inspector/InspectorNodeIds.h" 14 #include "core/inspector/InspectorNodeIds.h"
15 #include "core/inspector/ScriptCallStack.h" 15 #include "core/inspector/ScriptCallStack.h"
16 #include "core/page/Page.h" 16 #include "core/page/Page.h"
17 #include "core/rendering/RenderImage.h"
17 #include "core/rendering/RenderObject.h" 18 #include "core/rendering/RenderObject.h"
18 #include "core/xml/XMLHttpRequest.h" 19 #include "core/xml/XMLHttpRequest.h"
19 #include "platform/JSONValues.h" 20 #include "platform/JSONValues.h"
20 #include "platform/TracedValue.h" 21 #include "platform/TracedValue.h"
21 #include "platform/graphics/GraphicsLayer.h" 22 #include "platform/graphics/GraphicsLayer.h"
22 #include "platform/network/ResourceRequest.h" 23 #include "platform/network/ResourceRequest.h"
23 #include "platform/network/ResourceResponse.h" 24 #include "platform/network/ResourceResponse.h"
24 #include "platform/weborigin/KURL.h" 25 #include "platform/weborigin/KURL.h"
25 #include "wtf/Vector.h" 26 #include "wtf/Vector.h"
26 #include <inttypes.h> 27 #include <inttypes.h>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 110 }
110 111
111 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveResponseEvent:: data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& respon se) 112 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveResponseEvent:: data(unsigned long identifier, LocalFrame* frame, const ResourceResponse& respon se)
112 { 113 {
113 String requestId = IdentifiersFactory::requestId(identifier); 114 String requestId = IdentifiersFactory::requestId(identifier);
114 115
115 RefPtr<JSONObject> data = JSONObject::create(); 116 RefPtr<JSONObject> data = JSONObject::create();
116 data->setString("requestId", requestId); 117 data->setString("requestId", requestId);
117 data->setString("frame", toHexString(frame)); 118 data->setString("frame", toHexString(frame));
118 data->setNumber("statusCode", response.httpStatusCode()); 119 data->setNumber("statusCode", response.httpStatusCode());
119 data->setString("mimeType", response.mimeType()); 120 data->setString("mimeType", response.mimeType().string().isolatedCopy());
120 return TracedValue::fromJSONValue(data); 121 return TracedValue::fromJSONValue(data);
121 } 122 }
122 123
123 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveDataEvent::data (unsigned long identifier, LocalFrame* frame, int encodedDataLength) 124 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorReceiveDataEvent::data (unsigned long identifier, LocalFrame* frame, int encodedDataLength)
124 { 125 {
125 String requestId = IdentifiersFactory::requestId(identifier); 126 String requestId = IdentifiersFactory::requestId(identifier);
126 127
127 RefPtr<JSONObject> data = JSONObject::create(); 128 RefPtr<JSONObject> data = JSONObject::create();
128 data->setString("requestId", requestId); 129 data->setString("requestId", requestId);
129 data->setString("frame", toHexString(frame)); 130 data->setString("frame", toHexString(frame));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 { 289 {
289 RefPtr<JSONObject> data = JSONObject::create(); 290 RefPtr<JSONObject> data = JSONObject::create();
290 data->setString("scriptId", String::number(scriptId)); 291 data->setString("scriptId", String::number(scriptId));
291 data->setString("scriptName", scriptName); 292 data->setString("scriptName", scriptName);
292 data->setNumber("scriptLine", scriptLine); 293 data->setNumber("scriptLine", scriptLine);
293 if (LocalFrame* frame = frameForExecutionContext(context)) 294 if (LocalFrame* frame = frameForExecutionContext(context))
294 data->setString("frame", toHexString(frame)); 295 data->setString("frame", toHexString(frame));
295 return TracedValue::fromJSONValue(data); 296 return TracedValue::fromJSONValue(data);
296 } 297 }
297 298
299 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintImageEvent::data( const RenderImage& renderImage)
300 {
301 RefPtr<JSONObject> data = JSONObject::create();
302 data->setNumber("nodeId", InspectorNodeIds::idForNode(renderImage.generating Node()));
303
304 if (const ImageResource* resource = renderImage.cachedImage())
305 data->setString("url", resource->url().string());
306
307 return TracedValue::fromJSONValue(data);
308 }
309
298 static size_t usedHeapSize() 310 static size_t usedHeapSize()
299 { 311 {
300 HeapInfo info; 312 HeapInfo info;
301 ScriptGCEvent::getHeapSize(info); 313 ScriptGCEvent::getHeapSize(info);
302 return info.usedJSHeapSize; 314 return info.usedJSHeapSize;
303 } 315 }
304 316
305 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorUpdateCountersEvent::d ata() 317 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorUpdateCountersEvent::d ata()
306 { 318 {
307 RefPtr<JSONObject> data = JSONObject::create(); 319 RefPtr<JSONObject> data = JSONObject::create();
308 if (isMainThread()) { 320 if (isMainThread()) {
309 data->setNumber("documents", InspectorCounters::counterValue(InspectorCo unters::DocumentCounter)); 321 data->setNumber("documents", InspectorCounters::counterValue(InspectorCo unters::DocumentCounter));
310 data->setNumber("nodes", InspectorCounters::counterValue(InspectorCounte rs::NodeCounter)); 322 data->setNumber("nodes", InspectorCounters::counterValue(InspectorCounte rs::NodeCounter));
311 data->setNumber("jsEventListeners", InspectorCounters::counterValue(Insp ectorCounters::JSEventListenerCounter)); 323 data->setNumber("jsEventListeners", InspectorCounters::counterValue(Insp ectorCounters::JSEventListenerCounter));
312 } 324 }
313 data->setNumber("jsHeapSizeUsed", static_cast<double>(usedHeapSize())); 325 data->setNumber("jsHeapSizeUsed", static_cast<double>(usedHeapSize()));
314 return TracedValue::fromJSONValue(data); 326 return TracedValue::fromJSONValue(data);
315 } 327 }
316 328
317 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorCallStackEvent::curren tCallStack() 329 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorCallStackEvent::curren tCallStack()
318 { 330 {
319 return adoptRef(new JSCallStack(createScriptCallStack(ScriptCallStack::maxCa llStackSizeToCapture, true))); 331 return adoptRef(new JSCallStack(createScriptCallStack(ScriptCallStack::maxCa llStackSizeToCapture, true)));
320 } 332 }
321 333
322 } 334 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTraceEvents.h ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698