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/css/invalidation/DescendantInvalidationSet.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" |
21 #include "core/workers/WorkerThread.h" | 22 #include "core/workers/WorkerThread.h" |
22 #include "core/xml/XMLHttpRequest.h" | 23 #include "core/xml/XMLHttpRequest.h" |
23 #include "platform/JSONValues.h" | 24 #include "platform/JSONValues.h" |
24 #include "platform/TracedValue.h" | 25 #include "platform/TracedValue.h" |
25 #include "platform/graphics/GraphicsLayer.h" | 26 #include "platform/graphics/GraphicsLayer.h" |
26 #include "platform/network/ResourceRequest.h" | 27 #include "platform/network/ResourceRequest.h" |
27 #include "platform/network/ResourceResponse.h" | 28 #include "platform/network/ResourceResponse.h" |
28 #include "platform/weborigin/KURL.h" | 29 #include "platform/weborigin/KURL.h" |
29 #include "wtf/Vector.h" | 30 #include "wtf/Vector.h" |
31 #include "wtf/text/StringBuilder.h" | |
30 #include <inttypes.h> | 32 #include <inttypes.h> |
31 | 33 |
32 namespace blink { | 34 namespace blink { |
33 | 35 |
34 static const unsigned maxInvalidationTrackingCallstackSize = 5; | 36 static const unsigned maxInvalidationTrackingCallstackSize = 5; |
35 | 37 |
36 namespace { | 38 namespace { |
37 | 39 |
38 class JSCallStack : public TraceEvent::ConvertableToTraceFormat { | 40 class JSCallStack : public TraceEvent::ConvertableToTraceFormat { |
39 public: | 41 public: |
40 explicit JSCallStack(PassRefPtrWillBeRawPtr<ScriptCallStack> callstack) | 42 explicit JSCallStack(PassRefPtrWillBeRawPtr<ScriptCallStack> callstack) |
41 { | 43 { |
42 m_serialized = callstack ? callstack->buildInspectorArray()->toJSONStrin g() : "[]"; | 44 m_serialized = callstack ? callstack->buildInspectorArray()->toJSONStrin g() : "[]"; |
43 ASSERT(m_serialized.isSafeToSendToAnotherThread()); | 45 ASSERT(m_serialized.isSafeToSendToAnotherThread()); |
44 } | 46 } |
45 virtual String asTraceFormat() const | 47 virtual String asTraceFormat() const |
46 { | 48 { |
47 return m_serialized; | 49 return m_serialized; |
48 } | 50 } |
49 | 51 |
50 private: | 52 private: |
51 String m_serialized; | 53 String m_serialized; |
52 }; | 54 }; |
53 | 55 |
54 String toHexString(const void* p) | 56 String toHexString(const void* p) |
55 { | 57 { |
56 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p))); | 58 return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<int ptr_t>(p))); |
57 } | 59 } |
58 | 60 |
61 String invalidationListToString(const WillBeHeapVector<RefPtrWillBeMember<Descen dantInvalidationSet> >& invalidationList) | |
62 { | |
63 StringBuilder builder; | |
64 | |
65 builder.append("["); | |
66 bool isFirst = true; | |
67 for (const auto& invalidationSet : invalidationList) { | |
68 if (!isFirst) | |
69 builder.append(", "); | |
70 isFirst = false; | |
71 | |
72 builder.append(invalidationSet->toString()); | |
73 } | |
74 builder.append("]"); | |
75 return builder.toString(); | |
76 } | |
77 | |
59 } | 78 } |
60 | 79 |
80 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati onMap[] = "Element has pending invalidation map"; | |
81 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element."; | |
82 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri bute[] = "Invalidation set matched attribute."; | |
83 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass [] = "Invalidation set matched class."; | |
84 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id."; | |
85 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa me[] = "Invalidation set matched tagName."; | |
86 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen t[] = "Prevent style sharing for parent."; | |
87 | |
88 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali dateEvent::data(Element& element, const char* reason) | |
89 { | |
90 return withExtraData(element, reason, nullAtom); | |
91 } | |
92 | |
93 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali dateEvent::withExtraData(Element& element, const char* reason, const String& ext raData) | |
pdr.
2014/09/30 02:08:49
Can you use a default arg here to avoid needing tw
kouhei (in TOK)
2014/09/30 02:22:00
Acknowledged.
kouhei (in TOK)
2014/09/30 03:44:05
Done.
| |
94 { | |
95 RefPtr<TracedValue> value = TracedValue::create(); | |
pdr.
2014/09/30 03:21:57
We need the frame info here too. Can you add:
valu
kouhei (in TOK)
2014/09/30 03:44:05
Done.
| |
96 value->setInteger("nodeId", InspectorNodeIds::idForNode(&element)); | |
pdr.
2014/09/30 02:08:50
Can you use setNodeInfo here (from https://coderev
kouhei (in TOK)
2014/09/30 02:22:00
Acknowledged.
kouhei (in TOK)
2014/09/30 03:44:05
Done.
| |
97 value->setString("reason", reason); | |
98 value->setString("extraData", extraData); | |
pdr.
2014/09/30 02:08:49
Can we be more descriptive than just "extraData" (
kouhei (in TOK)
2014/09/30 02:22:00
Agreed, but want your help on naming.
"extraData"
pdr.
2014/09/30 03:21:57
Talked offline a bit. We don't actually have the e
kouhei (in TOK)
2014/09/30 03:44:05
Done.
| |
99 return value; | |
100 } | |
101 | |
102 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali dateEvent::invalidationList(Element& element, const WillBeHeapVector<RefPtrWillB eMember<DescendantInvalidationSet> >& invalidationList) | |
103 { | |
104 return withExtraData(element, InspectorStyleInvalidatorInvalidateEvent::Elem entHasPendingInvalidationMap, invalidationListToString(invalidationList)); | |
105 } | |
106 | |
61 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData (FrameView* frameView) | 107 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData (FrameView* frameView) |
62 { | 108 { |
63 bool isPartial; | 109 bool isPartial; |
64 unsigned needsLayoutObjects; | 110 unsigned needsLayoutObjects; |
65 unsigned totalObjects; | 111 unsigned totalObjects; |
66 LocalFrame& frame = frameView->frame(); | 112 LocalFrame& frame = frameView->frame(); |
67 frame.countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial) ; | 113 frame.countObjectsNeedingLayout(needsLayoutObjects, totalObjects, isPartial) ; |
68 | 114 |
69 RefPtr<TracedValue> value = TracedValue::create(); | 115 RefPtr<TracedValue> value = TracedValue::create(); |
70 value->setInteger("dirtyObjects", needsLayoutObjects); | 116 value->setInteger("dirtyObjects", needsLayoutObjects); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 | 448 |
403 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread) | 449 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorTracingSessionIdForWor kerEvent::data(const String& sessionId, WorkerThread* workerThread) |
404 { | 450 { |
405 RefPtr<TracedValue> value = TracedValue::create(); | 451 RefPtr<TracedValue> value = TracedValue::create(); |
406 value->setString("sessionId", sessionId); | 452 value->setString("sessionId", sessionId); |
407 value->setDouble("workerThreadId", workerThread->platformThreadId()); | 453 value->setDouble("workerThreadId", workerThread->platformThreadId()); |
408 return value; | 454 return value; |
409 } | 455 } |
410 | 456 |
411 } | 457 } |
OLD | NEW |