| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 m_processors.append(processor); | 59 m_processors.append(processor); |
| 60 if (m_processors.size() == 1) | 60 if (m_processors.size() == 1) |
| 61 client->setTraceEventCallback(dispatchEventOnAnyThread); | 61 client->setTraceEventCallback(dispatchEventOnAnyThread); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void removeProcessor(TimelineTraceEventProcessor* processor, InspectorClient
* client) | 64 void removeProcessor(TimelineTraceEventProcessor* processor, InspectorClient
* client) |
| 65 { | 65 { |
| 66 MutexLocker locker(m_mutex); | 66 MutexLocker locker(m_mutex); |
| 67 | 67 |
| 68 size_t index = m_processors.find(processor); | 68 size_t index = m_processors.find(processor); |
| 69 if (index == notFound) { | 69 if (index == kNotFound) { |
| 70 ASSERT_NOT_REACHED(); | 70 ASSERT_NOT_REACHED(); |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 m_processors.remove(index); | 73 m_processors.remove(index); |
| 74 if (m_processors.isEmpty()) | 74 if (m_processors.isEmpty()) |
| 75 client->setTraceEventCallback(0); | 75 client->setTraceEventCallback(0); |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 TraceEventDispatcher() { } | 79 TraceEventDispatcher() { } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 { | 189 { |
| 190 TraceEventDispatcher::instance()->removeProcessor(this, m_inspectorClient); | 190 TraceEventDispatcher::instance()->removeProcessor(this, m_inspectorClient); |
| 191 } | 191 } |
| 192 | 192 |
| 193 size_t TimelineTraceEventProcessor::TraceEvent::findParameter(const char* name)
const | 193 size_t TimelineTraceEventProcessor::TraceEvent::findParameter(const char* name)
const |
| 194 { | 194 { |
| 195 for (int i = 0; i < m_argumentCount; ++i) { | 195 for (int i = 0; i < m_argumentCount; ++i) { |
| 196 if (!strcmp(name, m_argumentNames[i])) | 196 if (!strcmp(name, m_argumentNames[i])) |
| 197 return i; | 197 return i; |
| 198 } | 198 } |
| 199 return notFound; | 199 return kNotFound; |
| 200 } | 200 } |
| 201 | 201 |
| 202 const TimelineTraceEventProcessor::TraceValueUnion& TimelineTraceEventProcessor:
:TraceEvent::parameter(const char* name, TraceValueTypes expectedType) const | 202 const TimelineTraceEventProcessor::TraceValueUnion& TimelineTraceEventProcessor:
:TraceEvent::parameter(const char* name, TraceValueTypes expectedType) const |
| 203 { | 203 { |
| 204 static TraceValueUnion missingValue; | 204 static TraceValueUnion missingValue; |
| 205 size_t index = findParameter(name); | 205 size_t index = findParameter(name); |
| 206 if (index == notFound || m_argumentTypes[index] != expectedType) { | 206 if (index == kNotFound || m_argumentTypes[index] != expectedType) { |
| 207 ASSERT_NOT_REACHED(); | 207 ASSERT_NOT_REACHED(); |
| 208 return missingValue; | 208 return missingValue; |
| 209 } | 209 } |
| 210 return *reinterpret_cast<const TraceValueUnion*>(m_argumentValues + index); | 210 return *reinterpret_cast<const TraceValueUnion*>(m_argumentValues + index); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void TimelineTraceEventProcessor::processEventOnAnyThread(TraceEventPhase phase,
const char* name, unsigned long long id, | 213 void TimelineTraceEventProcessor::processEventOnAnyThread(TraceEventPhase phase,
const char* name, unsigned long long id, |
| 214 int numArgs, const char* const* argNames, const unsigned char* argTypes, con
st unsigned long long* argValues, | 214 int numArgs, const char* const* argNames, const unsigned char* argTypes, con
st unsigned long long* argValues, |
| 215 unsigned char) | 215 unsigned char) |
| 216 { | 216 { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 for (size_t i = 0, size = events.size(); i < size; ++i) { | 389 for (size_t i = 0, size = events.size(); i < size; ++i) { |
| 390 const TraceEvent& event = events[i]; | 390 const TraceEvent& event = events[i]; |
| 391 HandlersMap::iterator it = m_handlersByType.find(std::make_pair(event.na
me(), event.phase())); | 391 HandlersMap::iterator it = m_handlersByType.find(std::make_pair(event.na
me(), event.phase())); |
| 392 ASSERT(it != m_handlersByType.end() && it->value); | 392 ASSERT(it != m_handlersByType.end() && it->value); |
| 393 (this->*(it->value))(event); | 393 (this->*(it->value))(event); |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace WebCore | 397 } // namespace WebCore |
| 398 | 398 |
| OLD | NEW |