| 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 "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/dom/StyleChangeReason.h" |
| 11 #include "core/events/Event.h" | 12 #include "core/events/Event.h" |
| 12 #include "core/frame/FrameView.h" | 13 #include "core/frame/FrameView.h" |
| 13 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
| 14 #include "core/inspector/IdentifiersFactory.h" | 15 #include "core/inspector/IdentifiersFactory.h" |
| 15 #include "core/inspector/InspectorNodeIds.h" | 16 #include "core/inspector/InspectorNodeIds.h" |
| 16 #include "core/inspector/ScriptCallStack.h" | 17 #include "core/inspector/ScriptCallStack.h" |
| 17 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
| 18 #include "core/rendering/RenderImage.h" | 19 #include "core/rendering/RenderImage.h" |
| 19 #include "core/rendering/RenderLayer.h" | 20 #include "core/rendering/RenderLayer.h" |
| 20 #include "core/rendering/RenderObject.h" | 21 #include "core/rendering/RenderObject.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 String m_serialized; | 52 String m_serialized; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 String toHexString(const void* p) | 55 String toHexString(const void* p) |
| 55 { | 56 { |
| 56 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int
ptr_t>(p))); | 57 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int
ptr_t>(p))); |
| 57 } | 58 } |
| 58 | 59 |
| 60 void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const
char* nameFieldName = 0) |
| 61 { |
| 62 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); |
| 63 if (nameFieldName) |
| 64 value->setString(nameFieldName, node->debugName()); |
| 65 } |
| 66 |
| 59 } | 67 } |
| 60 | 68 |
| 69 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleRecalcInvalidatio
nTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) |
| 70 { |
| 71 RefPtr<TracedValue> value = TracedValue::create(); |
| 72 setNodeInfo(value.get(), node, "nodeId", "nodeName"); |
| 73 value->setString("reason", reason.reasonString()); |
| 74 value->setString("extraData", reason.extraData()); |
| 75 return value.release(); |
| 76 } |
| 77 |
| 61 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData
(FrameView* frameView) | 78 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData
(FrameView* frameView) |
| 62 { | 79 { |
| 63 bool isPartial; | 80 bool isPartial; |
| 64 unsigned needsLayoutObjects; | 81 unsigned needsLayoutObjects; |
| 65 unsigned totalObjects; | 82 unsigned totalObjects; |
| 66 LocalFrame& frame = frameView->frame(); | 83 LocalFrame& frame = frameView->frame(); |
| 67 frame.countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial)
; | 84 frame.countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial)
; |
| 68 | 85 |
| 69 RefPtr<TracedValue> value = TracedValue::create(); | 86 RefPtr<TracedValue> value = TracedValue::create(); |
| 70 value->setInteger("dirtyObjects", needsLayoutObjects); | 87 value->setInteger("dirtyObjects", needsLayoutObjects); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 88 value->endArray(); | 105 value->endArray(); |
| 89 } | 106 } |
| 90 | 107 |
| 91 static void setGeneratingNodeInfo(TracedValue* value, const RenderObject* render
er, const char* idFieldName, const char* nameFieldName = 0) | 108 static void setGeneratingNodeInfo(TracedValue* value, const RenderObject* render
er, const char* idFieldName, const char* nameFieldName = 0) |
| 92 { | 109 { |
| 93 Node* node = 0; | 110 Node* node = 0; |
| 94 for (; renderer && !node; renderer = renderer->parent()) | 111 for (; renderer && !node; renderer = renderer->parent()) |
| 95 node = renderer->generatingNode(); | 112 node = renderer->generatingNode(); |
| 96 if (!node) | 113 if (!node) |
| 97 return; | 114 return; |
| 98 value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); | 115 |
| 99 if (nameFieldName) | 116 setNodeInfo(value, node, idFieldName, nameFieldName); |
| 100 value->setString(nameFieldName, node->debugName()); | |
| 101 } | 117 } |
| 102 | 118 |
| 103 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::endData(R
enderObject* rootForThisLayout) | 119 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::endData(R
enderObject* rootForThisLayout) |
| 104 { | 120 { |
| 105 Vector<FloatQuad> quads; | 121 Vector<FloatQuad> quads; |
| 106 rootForThisLayout->absoluteQuads(quads); | 122 rootForThisLayout->absoluteQuads(quads); |
| 107 | 123 |
| 108 RefPtr<TracedValue> value = TracedValue::create(); | 124 RefPtr<TracedValue> value = TracedValue::create(); |
| 109 if (quads.size() >= 1) { | 125 if (quads.size() >= 1) { |
| 110 createQuad(value.get(), "root", quads[0]); | 126 createQuad(value.get(), "root", quads[0]); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 418 |
| 403 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor
kerEvent::data(const String& sessionId, WorkerThread* workerThread) | 419 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor
kerEvent::data(const String& sessionId, WorkerThread* workerThread) |
| 404 { | 420 { |
| 405 RefPtr<TracedValue> value = TracedValue::create(); | 421 RefPtr<TracedValue> value = TracedValue::create(); |
| 406 value->setString("sessionId", sessionId); | 422 value->setString("sessionId", sessionId); |
| 407 value->setDouble("workerThreadId", workerThread->platformThreadId()); | 423 value->setDouble("workerThreadId", workerThread->platformThreadId()); |
| 408 return value; | 424 return value; |
| 409 } | 425 } |
| 410 | 426 |
| 411 } | 427 } |
| OLD | NEW |