Chromium Code Reviews| Index: Source/core/inspector/InspectorTraceEvents.cpp |
| diff --git a/Source/core/inspector/InspectorTraceEvents.cpp b/Source/core/inspector/InspectorTraceEvents.cpp |
| index 1afdb1d089d498dda8b1146f1776faa1b4eb2437..630b22d0a4fafc88358db055420fdbcd6081fadb 100644 |
| --- a/Source/core/inspector/InspectorTraceEvents.cpp |
| +++ b/Source/core/inspector/InspectorTraceEvents.cpp |
| @@ -8,6 +8,7 @@ |
| #include "bindings/core/v8/ScriptCallStackFactory.h" |
| #include "bindings/core/v8/ScriptGCEvent.h" |
| #include "bindings/core/v8/ScriptSourceCode.h" |
| +#include "core/css/invalidation/DescendantInvalidationSet.h" |
| #include "core/events/Event.h" |
| #include "core/frame/FrameView.h" |
| #include "core/frame/LocalFrame.h" |
| @@ -27,6 +28,7 @@ |
| #include "platform/network/ResourceResponse.h" |
| #include "platform/weborigin/KURL.h" |
| #include "wtf/Vector.h" |
| +#include "wtf/text/StringBuilder.h" |
| #include <inttypes.h> |
| namespace blink { |
| @@ -56,6 +58,53 @@ String toHexString(const void* p) |
| return String::format("0x%" PRIx64, static_cast<uint64>(reinterpret_cast<intptr_t>(p))); |
| } |
| +void setNodeInfo(TracedValue* value, Node* node, const char* idFieldName, const char* nameFieldName = 0) |
| +{ |
| + value->setInteger(idFieldName, InspectorNodeIds::idForNode(node)); |
| + if (nameFieldName) |
| + value->setString(nameFieldName, node->debugName()); |
| +} |
| + |
| +String invalidationListToString(const WillBeHeapVector<RefPtrWillBeMember<DescendantInvalidationSet> >& invalidationList) |
| +{ |
| + StringBuilder builder; |
|
yurys
2014/09/30 09:21:14
Please use TracedValue instead for building the st
caseq
2014/09/30 12:24:00
+1 to that.
kouhei (in TOK)
2014/10/01 04:16:14
Done.
|
| + |
| + builder.append("["); |
| + bool isFirst = true; |
| + for (const auto& invalidationSet : invalidationList) { |
| + if (!isFirst) |
| + builder.append(", "); |
| + isFirst = false; |
| + |
| + builder.append(invalidationSet->toDebugString()); |
| + } |
| + builder.append("]"); |
| + return builder.toString(); |
| +} |
| + |
| +} |
| + |
| +const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidationMap[] = "Element has pending invalidation map"; |
| +const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] = "Invalidate custom pseudo element."; |
| +const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttribute[] = "Invalidation set matched attribute."; |
| +const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass[] = "Invalidation set matched class."; |
| +const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[] = "Invalidation set matched id."; |
| +const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagName[] = "Invalidation set matched tagName."; |
| +const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParent[] = "Prevent style sharing for parent."; |
| + |
| +PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvalidateEvent::data(Element& element, const char* reason, const String& selectorPart) |
| +{ |
| + RefPtr<TracedValue> value = TracedValue::create(); |
| + value->setString("frame", toHexString(element.document().frame())); |
| + setNodeInfo(value.get(), &element, "nodeId", "nodeName"); |
| + value->setString("reason", reason); |
| + value->setString("selectorPart", selectorPart); |
| + return value; |
|
caseq
2014/09/30 12:24:00
nit: value.release(), since you've just changed th
kouhei (in TOK)
2014/10/01 04:16:14
Done.
|
| +} |
| + |
| +PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvalidateEvent::invalidationList(Element& element, const WillBeHeapVector<RefPtrWillBeMember<DescendantInvalidationSet> >& invalidationList) |
| +{ |
| + return data(element, InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidationMap, invalidationListToString(invalidationList)); |
| } |
| PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayoutEvent::beginData(FrameView* frameView) |