Index: third_party/WebKit/Source/platform/EventTracer.cpp |
diff --git a/third_party/WebKit/Source/platform/EventTracer.cpp b/third_party/WebKit/Source/platform/EventTracer.cpp |
index 4bce3220ac569b75ffc61f608ee19d15a6f0b76d..0e2b0379a103de50eee16db679c619b862f0fb37 100644 |
--- a/third_party/WebKit/Source/platform/EventTracer.cpp |
+++ b/third_party/WebKit/Source/platform/EventTracer.cpp |
@@ -32,6 +32,8 @@ |
#include "base/time/time.h" |
#include "base/trace_event/trace_event.h" |
+#include "base/trace_event/trace_event_argument.h" |
+#include "platform/TracedValue.h" |
#include "public/platform/Platform.h" |
#include "wtf/Assertions.h" |
#include "wtf/text/StringUTF8Adaptor.h" |
@@ -42,37 +44,6 @@ namespace blink { |
static_assert(sizeof(TraceEvent::TraceEventHandle) == sizeof(base::trace_event::TraceEventHandle), "TraceEventHandle types must be the same"); |
static_assert(sizeof(TraceEvent::TraceEventAPIAtomicWord) == sizeof(const char*), "TraceEventAPIAtomicWord must be pointer-sized."); |
-namespace { |
- |
-class ConvertableToTraceFormatWrapper : public base::trace_event::ConvertableToTraceFormat { |
-public: |
- // We move a reference pointer from |convertable| to |m_convertable|, |
- // rather than copying, for thread safety. https://crbug.com/478149 |
- explicit ConvertableToTraceFormatWrapper(PassRefPtr<blink::TraceEvent::ConvertableToTraceFormat> convertable) |
- : m_convertable(convertable) |
- { |
- ASSERT(m_convertable); |
- } |
- void AppendAsTraceFormat(std::string* out) const override |
- { |
- // TODO(bashi): Avoid copying. |
- String traceFormat = m_convertable->asTraceFormat(); |
- StringUTF8Adaptor utf8(traceFormat); |
- out->append(utf8.data(), utf8.length()); |
- } |
- void EstimateTraceMemoryOverhead(base::trace_event::TraceEventMemoryOverhead* overhead) |
- { |
- m_convertable->estimateTraceMemoryOverhead(overhead); |
- } |
- |
-private: |
- ~ConvertableToTraceFormatWrapper() override {} |
- |
- RefPtr<blink::TraceEvent::ConvertableToTraceFormat> m_convertable; |
-}; |
- |
-} // namespace |
- |
// The dummy variable is needed to avoid a crash when someone updates the state variables |
// before EventTracer::initialize() is called. |
TraceEvent::TraceEventAPIAtomicWord dummyTraceSamplingState = 0; |
@@ -101,17 +72,17 @@ TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsign |
const char* name, unsigned long long id, unsigned long long bindId, double timestamp, |
int numArgs, const char* argNames[], const unsigned char argTypes[], |
const unsigned long long argValues[], |
- PassRefPtr<TraceEvent::ConvertableToTraceFormat> convertableValue1, |
- PassRefPtr<TraceEvent::ConvertableToTraceFormat> convertableValue2, |
+ PassRefPtr<TracedValue> convertableValue1, |
+ PassRefPtr<TracedValue> convertableValue2, |
unsigned flags) |
{ |
- scoped_refptr<base::trace_event::ConvertableToTraceFormat> wrappers[2]; |
+ scoped_refptr<base::trace_event::ConvertableToTraceFormat> convertables[2]; |
ASSERT(numArgs <= 2); |
if (numArgs >= 1 && argTypes[0] == TRACE_VALUE_TYPE_CONVERTABLE) |
- wrappers[0] = new ConvertableToTraceFormatWrapper(convertableValue1); |
+ convertables[0] = convertableValue1->m_tracedValue; |
hiroshige
2016/01/28 12:05:01
Probably we have to move the scoped_ptr from |conv
bashi
2016/01/29 02:25:26
Good catch! Done.
|
if (numArgs >= 2 && argTypes[1] == TRACE_VALUE_TYPE_CONVERTABLE) |
- wrappers[1] = new ConvertableToTraceFormatWrapper(convertableValue2); |
- return addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, wrappers, flags); |
+ convertables[1] = convertableValue2->m_tracedValue; |
hiroshige
2016/01/28 12:05:01
ditto.
|
+ return addTraceEvent(phase, categoryEnabledFlag, name, id, bindId, timestamp, numArgs, argNames, argTypes, argValues, convertables, flags); |
} |
TraceEvent::TraceEventHandle EventTracer::addTraceEvent(char phase, const unsigned char* categoryEnabledFlag, |