| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 , m_id(id) | 67 , m_id(id) |
| 68 , m_threadIdentifier(threadIdentifier) | 68 , m_threadIdentifier(threadIdentifier) |
| 69 , m_argumentCount(argumentCount) | 69 , m_argumentCount(argumentCount) |
| 70 { | 70 { |
| 71 if (m_argumentCount > MaxArguments) { | 71 if (m_argumentCount > MaxArguments) { |
| 72 ASSERT_NOT_REACHED(); | 72 ASSERT_NOT_REACHED(); |
| 73 m_argumentCount = MaxArguments; | 73 m_argumentCount = MaxArguments; |
| 74 } | 74 } |
| 75 for (int i = 0; i < m_argumentCount; ++i) { | 75 for (int i = 0; i < m_argumentCount; ++i) { |
| 76 m_argumentNames[i] = argumentNames[i]; | 76 m_argumentNames[i] = argumentNames[i]; |
| 77 m_argumentTypes[i] = argumentTypes[i]; | 77 if (argumentTypes[i] == TRACE_VALUE_TYPE_COPY_STRING) { |
| 78 m_argumentValues[i] = argumentValues[i]; | 78 m_stringArguments[i] = reinterpret_cast<const char*>(argumen
tValues[i]); |
| 79 m_argumentValues[i].m_string = reinterpret_cast<const char*>
(m_stringArguments[i].characters8()); |
| 80 m_argumentTypes[i] = TRACE_VALUE_TYPE_STRING; |
| 81 } else { |
| 82 m_argumentValues[i].m_int = argumentValues[i]; |
| 83 m_argumentTypes[i] = argumentTypes[i]; |
| 84 } |
| 79 } | 85 } |
| 80 } | 86 } |
| 81 | 87 |
| 82 double timestamp() const { return m_timestamp; } | 88 double timestamp() const { return m_timestamp; } |
| 83 char phase() const { return m_phase; } | 89 char phase() const { return m_phase; } |
| 84 const char* name() const { return m_name; } | 90 const char* name() const { return m_name; } |
| 85 unsigned long long id() const { return m_id; } | 91 unsigned long long id() const { return m_id; } |
| 86 ThreadIdentifier threadIdentifier() const { return m_threadIdentifier; } | 92 ThreadIdentifier threadIdentifier() const { return m_threadIdentifier; } |
| 87 int argumentCount() const { return m_argumentCount; } | 93 int argumentCount() const { return m_argumentCount; } |
| 88 bool isNull() const { return !m_name; } | 94 bool isNull() const { return !m_name; } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 const WebCore::TraceEvent::TraceValueUnion& parameter(const char* name,
unsigned char expectedType) const; | 126 const WebCore::TraceEvent::TraceValueUnion& parameter(const char* name,
unsigned char expectedType) const; |
| 121 | 127 |
| 122 double m_timestamp; | 128 double m_timestamp; |
| 123 char m_phase; | 129 char m_phase; |
| 124 const char* m_name; | 130 const char* m_name; |
| 125 unsigned long long m_id; | 131 unsigned long long m_id; |
| 126 ThreadIdentifier m_threadIdentifier; | 132 ThreadIdentifier m_threadIdentifier; |
| 127 int m_argumentCount; | 133 int m_argumentCount; |
| 128 const char* m_argumentNames[MaxArguments]; | 134 const char* m_argumentNames[MaxArguments]; |
| 129 unsigned char m_argumentTypes[MaxArguments]; | 135 unsigned char m_argumentTypes[MaxArguments]; |
| 130 unsigned long long m_argumentValues[MaxArguments]; | 136 WebCore::TraceEvent::TraceValueUnion m_argumentValues[MaxArguments]; |
| 137 // These are only used as buffers for TRACE_VALUE_TYPE_COPY_STRING. |
| 138 // Consider allocating the entire vector of buffered trace events and th
eir copied arguments out of a special arena |
| 139 // to make things more compact. |
| 140 String m_stringArguments[MaxArguments]; |
| 131 }; | 141 }; |
| 132 | 142 |
| 133 typedef void (TraceEventTargetBase::*TraceEventHandlerMethod)(const TraceEve
nt&); | 143 typedef void (TraceEventTargetBase::*TraceEventHandlerMethod)(const TraceEve
nt&); |
| 134 | 144 |
| 135 static TraceEventDispatcher* instance() | 145 static TraceEventDispatcher* instance() |
| 136 { | 146 { |
| 137 DEFINE_STATIC_LOCAL(TraceEventDispatcher, instance, ()); | 147 DEFINE_STATIC_LOCAL(TraceEventDispatcher, instance, ()); |
| 138 return &instance; | 148 return &instance; |
| 139 } | 149 } |
| 140 | 150 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 double m_lastEventProcessingTime; | 193 double m_lastEventProcessingTime; |
| 184 }; | 194 }; |
| 185 | 195 |
| 186 template<typename C> struct TraceEventTarget : public TraceEventTargetBase { | 196 template<typename C> struct TraceEventTarget : public TraceEventTargetBase { |
| 187 typedef void (C::*TraceEventHandler)(const TraceEventDispatcher::TraceEvent&
); | 197 typedef void (C::*TraceEventHandler)(const TraceEventDispatcher::TraceEvent&
); |
| 188 }; | 198 }; |
| 189 | 199 |
| 190 } // namespace WebCore | 200 } // namespace WebCore |
| 191 | 201 |
| 192 #endif // TraceEventDispatcher_h | 202 #endif // TraceEventDispatcher_h |
| OLD | NEW |