| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return &instance; | 146 return &instance; |
| 147 } | 147 } |
| 148 | 148 |
| 149 void addListener(const char* name, char phase, PassOwnPtrWillBeRawPtr<TraceE
ventListener>, InspectorClient*); | 149 void addListener(const char* name, char phase, PassOwnPtrWillBeRawPtr<TraceE
ventListener>, InspectorClient*); |
| 150 | 150 |
| 151 void removeAllListeners(void*, InspectorClient*); | 151 void removeAllListeners(void*, InspectorClient*); |
| 152 void processBackgroundEvents(); | 152 void processBackgroundEvents(); |
| 153 | 153 |
| 154 private: | 154 private: |
| 155 typedef std::pair<String, int> EventSelector; | 155 typedef std::pair<String, int> EventSelector; |
| 156 typedef WillBeHeapHashMap<EventSelector, OwnPtrWillBeMember<WillBeHeapVector
<OwnPtrWillBeMember<TraceEventListener> > > > ListenersMap; | 156 typedef WillBeHeapHashMap<EventSelector, OwnPtrWillBeMember<WillBeHeapVector
<OwnPtrWillBeMember<TraceEventListener>>>> ListenersMap; |
| 157 | 157 |
| 158 TraceEventDispatcher() | 158 TraceEventDispatcher() |
| 159 : m_listeners(adoptPtrWillBeNoop(new ListenersMap())) | 159 : m_listeners(adoptPtrWillBeNoop(new ListenersMap())) |
| 160 , m_processEventsTaskInFlight(false) | 160 , m_processEventsTaskInFlight(false) |
| 161 , m_lastEventProcessingTime(0) | 161 , m_lastEventProcessingTime(0) |
| 162 { | 162 { |
| 163 } | 163 } |
| 164 | 164 |
| 165 static void dispatchEventOnAnyThread(char phase, const unsigned char*, const
char* name, unsigned long long id, | 165 static void dispatchEventOnAnyThread(char phase, const unsigned char*, const
char* name, unsigned long long id, |
| 166 int numArgs, const char* const* argNames, const unsigned char* argTypes,
const unsigned long long* argValues, | 166 int numArgs, const char* const* argNames, const unsigned char* argTypes,
const unsigned long long* argValues, |
| 167 unsigned char flags, double timestamp); | 167 unsigned char flags, double timestamp); |
| 168 | 168 |
| 169 void enqueueEvent(double timestamp, char phase, const char* name, unsigned l
ong long id, ThreadIdentifier, | 169 void enqueueEvent(double timestamp, char phase, const char* name, unsigned l
ong long id, ThreadIdentifier, |
| 170 int argumentCount, const char* const* argumentNames, const unsigned char
* argumentTypes, const unsigned long long* argumentValues); | 170 int argumentCount, const char* const* argumentNames, const unsigned char
* argumentTypes, const unsigned long long* argumentValues); |
| 171 void processBackgroundEventsTask(); | 171 void processBackgroundEventsTask(); |
| 172 | 172 |
| 173 Mutex m_mutex; | 173 Mutex m_mutex; |
| 174 OwnPtrWillBePersistent<ListenersMap> m_listeners; | 174 OwnPtrWillBePersistent<ListenersMap> m_listeners; |
| 175 Vector<TraceEvent> m_backgroundEvents; | 175 Vector<TraceEvent> m_backgroundEvents; |
| 176 bool m_processEventsTaskInFlight; | 176 bool m_processEventsTaskInFlight; |
| 177 double m_lastEventProcessingTime; | 177 double m_lastEventProcessingTime; |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace blink | 180 } // namespace blink |
| 181 | 181 |
| 182 #endif // TraceEventDispatcher_h | 182 #endif // TraceEventDispatcher_h |
| OLD | NEW |