Commit 669e7a23 authored by caseq@chromium.org's avatar caseq@chromium.org

DevTools: support TRACE_VALUE_TYPE_COPY_STRING

These strings need to be copied along with the event. We only used to
support static strings so far.

BUG=

Review URL: https://codereview.chromium.org/184303002

git-svn-id: svn://svn.chromium.org/blink/trunk@168363 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 04d9caf8
......@@ -151,11 +151,12 @@ const TraceEvent::TraceValueUnion& TraceEventDispatcher::TraceEvent::parameter(c
{
static WebCore::TraceEvent::TraceValueUnion missingValue;
size_t index = findParameter(name);
ASSERT(isMainThread());
if (index == kNotFound || m_argumentTypes[index] != expectedType) {
ASSERT_NOT_REACHED();
return missingValue;
}
return *reinterpret_cast<const WebCore::TraceEvent::TraceValueUnion*>(m_argumentValues + index);
return m_argumentValues[index];
}
} // namespace WebCore
......
......@@ -74,8 +74,14 @@ public:
}
for (int i = 0; i < m_argumentCount; ++i) {
m_argumentNames[i] = argumentNames[i];
m_argumentTypes[i] = argumentTypes[i];
m_argumentValues[i] = argumentValues[i];
if (argumentTypes[i] == TRACE_VALUE_TYPE_COPY_STRING) {
m_stringArguments[i] = reinterpret_cast<const char*>(argumentValues[i]);
m_argumentValues[i].m_string = reinterpret_cast<const char*>(m_stringArguments[i].characters8());
m_argumentTypes[i] = TRACE_VALUE_TYPE_STRING;
} else {
m_argumentValues[i].m_int = argumentValues[i];
m_argumentTypes[i] = argumentTypes[i];
}
}
}
......@@ -127,7 +133,11 @@ public:
int m_argumentCount;
const char* m_argumentNames[MaxArguments];
unsigned char m_argumentTypes[MaxArguments];
unsigned long long m_argumentValues[MaxArguments];
WebCore::TraceEvent::TraceValueUnion m_argumentValues[MaxArguments];
// These are only used as buffers for TRACE_VALUE_TYPE_COPY_STRING.
// Consider allocating the entire vector of buffered trace events and their copied arguments out of a special arena
// to make things more compact.
String m_stringArguments[MaxArguments];
};
typedef void (TraceEventTargetBase::*TraceEventHandlerMethod)(const TraceEvent&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment