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

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

Issue 465223002: [ Do not submit ] Prototype for invalidation analysis Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Unify the three invalidation trace event categories Created 6 years, 3 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
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/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/events/Event.h" 11 #include "core/events/Event.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/frame/LocalFrame.h" 13 #include "core/frame/LocalFrame.h"
14 #include "core/inspector/IdentifiersFactory.h" 14 #include "core/inspector/IdentifiersFactory.h"
15 #include "core/inspector/InspectorNodeIds.h" 15 #include "core/inspector/InspectorNodeIds.h"
16 #include "core/inspector/ScriptCallStack.h" 16 #include "core/inspector/ScriptCallStack.h"
17 #include "core/page/Page.h" 17 #include "core/page/Page.h"
18 #include "core/rendering/RenderImage.h" 18 #include "core/rendering/RenderImage.h"
19 #include "core/rendering/RenderLayer.h"
19 #include "core/rendering/RenderObject.h" 20 #include "core/rendering/RenderObject.h"
20 #include "core/xml/XMLHttpRequest.h" 21 #include "core/xml/XMLHttpRequest.h"
21 #include "platform/JSONValues.h" 22 #include "platform/JSONValues.h"
22 #include "platform/TracedValue.h" 23 #include "platform/TracedValue.h"
23 #include "platform/graphics/GraphicsLayer.h" 24 #include "platform/graphics/GraphicsLayer.h"
24 #include "platform/network/ResourceRequest.h" 25 #include "platform/network/ResourceRequest.h"
25 #include "platform/network/ResourceResponse.h" 26 #include "platform/network/ResourceResponse.h"
26 #include "platform/weborigin/KURL.h" 27 #include "platform/weborigin/KURL.h"
27 #include "wtf/Vector.h" 28 #include "wtf/Vector.h"
28 #include <inttypes.h> 29 #include <inttypes.h>
(...skipping 11 matching lines...) Expand all
40 } 41 }
41 virtual String asTraceFormat() const 42 virtual String asTraceFormat() const
42 { 43 {
43 return m_serialized; 44 return m_serialized;
44 } 45 }
45 46
46 private: 47 private:
47 String m_serialized; 48 String m_serialized;
48 }; 49 };
49 50
50 String toHexString(void* p) 51 String toHexString(const void* p)
51 { 52 {
52 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p))); 53 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p)));
53 } 54 }
54 55
55 } 56 }
56 57
57 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData (FrameView* frameView) 58 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData (FrameView* frameView)
58 { 59 {
59 bool isPartial; 60 bool isPartial;
60 unsigned needsLayoutObjects; 61 unsigned needsLayoutObjects;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 RefPtr<TracedValue> value = TracedValue::create(); 103 RefPtr<TracedValue> value = TracedValue::create();
103 if (quads.size() >= 1) { 104 if (quads.size() >= 1) {
104 createQuad(value.get(), "root", quads[0]); 105 createQuad(value.get(), "root", quads[0]);
105 setGeneratingNodeId(value.get(), "rootNode", rootForThisLayout); 106 setGeneratingNodeId(value.get(), "rootNode", rootForThisLayout);
106 } else { 107 } else {
107 ASSERT_NOT_REACHED(); 108 ASSERT_NOT_REACHED();
108 } 109 }
109 return value; 110 return value;
110 } 111 }
111 112
113 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidationTrack ingEvent::data(Node* node)
114 {
115 ASSERT(node);
116 RefPtr<TracedValue> value = TracedValue::create();
117 value->setString("frame", toHexString(node->document().frame()));
118 value->setString("nodeName", node->debugName());
119 value->setInteger("nodeId", InspectorNodeIds::idForNode(node));
120 RefPtr<ScriptCallStack> callstack = createScriptCallStack(5, true);
121 value->setString("callstack", callstack ? callstack->buildInspectorArray()-> toJSONString() : "[]");
122 return value;
123 }
124
125 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutInvalidationTrac kingEvent::data(const RenderObject* renderer)
126 {
127 ASSERT(renderer);
128 RefPtr<TracedValue> value = TracedValue::create();
129 value->setString("frame", toHexString(renderer->frame()));
130 value->setString("rendererId", toHexString(renderer));
131 if (Node* generatingNode = renderer->generatingNode()) {
132 value->setString("nodeName", generatingNode->debugName());
133 value->setInteger("nodeId", InspectorNodeIds::idForNode(generatingNode)) ;
134 }
135 RefPtr<ScriptCallStack> callstack = createScriptCallStack(5, true);
136 value->setString("callstack", callstack ? callstack->buildInspectorArray()-> toJSONString() : "[]");
137 return value;
138 }
139
140 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintInvalidationTrack ingEvent::data(const RenderObject* renderer, const RenderObject* paintRenderer)
141 {
142 ASSERT(renderer);
143 RefPtr<TracedValue> value = TracedValue::create();
144 value->setString("frame", toHexString(renderer->frame()));
145 value->setString("rendererId", toHexString(renderer));
146 value->setString("paintId", toHexString(paintRenderer));
147 if (Node* generatingNode = renderer->generatingNode()) {
148 value->setString("nodeName", generatingNode->debugName());
149 value->setInteger("nodeId", InspectorNodeIds::idForNode(generatingNode)) ;
150 }
151 return value;
152 }
153
112 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorSendRequestEvent::data (unsigned long identifier, LocalFrame* frame, const ResourceRequest& request) 154 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorSendRequestEvent::data (unsigned long identifier, LocalFrame* frame, const ResourceRequest& request)
113 { 155 {
114 String requestId = IdentifiersFactory::requestId(identifier); 156 String requestId = IdentifiersFactory::requestId(identifier);
115 157
116 RefPtr<TracedValue> value = TracedValue::create(); 158 RefPtr<TracedValue> value = TracedValue::create();
117 value->setString("requestId", requestId); 159 value->setString("requestId", requestId);
118 value->setString("frame", toHexString(frame)); 160 value->setString("frame", toHexString(frame));
119 value->setString("url", request.url().string()); 161 value->setString("url", request.url().string());
120 value->setString("requestMethod", request.httpMethod()); 162 value->setString("requestMethod", request.httpMethod());
121 return value; 163 return value;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 quad->setP1(view->contentsToRootView(roundedIntPoint(absolute.p1()))); 295 quad->setP1(view->contentsToRootView(roundedIntPoint(absolute.p1())));
254 quad->setP2(view->contentsToRootView(roundedIntPoint(absolute.p2()))); 296 quad->setP2(view->contentsToRootView(roundedIntPoint(absolute.p2())));
255 quad->setP3(view->contentsToRootView(roundedIntPoint(absolute.p3()))); 297 quad->setP3(view->contentsToRootView(roundedIntPoint(absolute.p3())));
256 quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4()))); 298 quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4())));
257 } 299 }
258 300
259 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintEvent::data(Rende rObject* renderer, const LayoutRect& clipRect, const GraphicsLayer* graphicsLaye r) 301 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorPaintEvent::data(Rende rObject* renderer, const LayoutRect& clipRect, const GraphicsLayer* graphicsLaye r)
260 { 302 {
261 RefPtr<TracedValue> value = TracedValue::create(); 303 RefPtr<TracedValue> value = TracedValue::create();
262 value->setString("frame", toHexString(renderer->frame())); 304 value->setString("frame", toHexString(renderer->frame()));
305 value->setString("paintId", toHexString(renderer));
263 FloatQuad quad; 306 FloatQuad quad;
264 localToPageQuad(*renderer, clipRect, &quad); 307 localToPageQuad(*renderer, clipRect, &quad);
265 createQuad(value.get(), "clip", quad); 308 createQuad(value.get(), "clip", quad);
266 setGeneratingNodeId(value.get(), "nodeId", renderer); 309 setGeneratingNodeId(value.get(), "nodeId", renderer);
267 int graphicsLayerId = graphicsLayer ? graphicsLayer->platformLayer()->id() : 0; 310 int graphicsLayerId = graphicsLayer ? graphicsLayer->platformLayer()->id() : 0;
268 value->setInteger("layerId", graphicsLayerId); 311 value->setInteger("layerId", graphicsLayerId);
269 return value; 312 return value;
270 } 313 }
271 314
272 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorMarkLoadEvent::data(Lo calFrame* frame) 315 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorMarkLoadEvent::data(Lo calFrame* frame)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimeStampEvent::data(E xecutionContext* context, const String& message) 392 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTimeStampEvent::data(E xecutionContext* context, const String& message)
350 { 393 {
351 RefPtr<TracedValue> value = TracedValue::create(); 394 RefPtr<TracedValue> value = TracedValue::create();
352 value->setString("message", message); 395 value->setString("message", message);
353 if (LocalFrame* frame = frameForExecutionContext(context)) 396 if (LocalFrame* frame = frameForExecutionContext(context))
354 value->setString("frame", toHexString(frame)); 397 value->setString("frame", toHexString(frame));
355 return value; 398 return value;
356 } 399 }
357 400
358 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698