Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: Source/core/inspector/TraceEventDispatcher.h

Issue 307943002: Oilpan: Prepare moving InspectorController and InspectorAgents to oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/PageRuntimeAgent.cpp ('k') | Source/core/inspector/TraceEventDispatcher.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/TraceEventDispatcher.h
diff --git a/Source/core/inspector/TraceEventDispatcher.h b/Source/core/inspector/TraceEventDispatcher.h
index f34431e2dccb5600e59cd8a4fcd738e594680e45..4c986b01281d132ba2df5ebca92edd0b3034139d 100644
--- a/Source/core/inspector/TraceEventDispatcher.h
+++ b/Source/core/inspector/TraceEventDispatcher.h
@@ -32,22 +32,18 @@
#define TraceEventDispatcher_h
#include "platform/TraceEvent.h"
+#include "platform/heap/Handle.h"
#include "wtf/HashMap.h"
#include "wtf/Threading.h"
#include "wtf/ThreadingPrimitives.h"
#include "wtf/Vector.h"
+#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
namespace blink {
class InspectorClient;
-struct TraceEventTargetBase {
- virtual ~TraceEventTargetBase() { }
-};
-
-template<typename C> struct TraceEventTarget;
-
class TraceEventDispatcher {
WTF_MAKE_NONCOPYABLE(TraceEventDispatcher);
public:
@@ -140,7 +136,15 @@ public:
String m_stringArguments[MaxArguments];
};
- typedef void (TraceEventTargetBase::*TraceEventHandlerMethod)(const TraceEvent&);
+ class TraceEventListener : public NoBaseWillBeGarbageCollected<TraceEventListener> {
+ public:
+#if !ENABLE(OILPAN)
+ virtual ~TraceEventListener() { }
+#endif
+ virtual void call(const TraceEventDispatcher::TraceEvent&) = 0;
+ virtual void* target() = 0;
+ virtual void trace(Visitor*) { }
+ };
static TraceEventDispatcher* instance()
{
@@ -148,32 +152,18 @@ public:
return &instance;
}
- template<typename ListenerClass>
- void addListener(const char* name, char phase, ListenerClass* instance, typename TraceEventTarget<ListenerClass>::TraceEventHandler handler, InspectorClient* client)
- {
- innerAddListener(name, phase, instance, static_cast<TraceEventHandlerMethod>(handler), client);
- }
+ void addListener(const char* name, char phase, PassOwnPtrWillBeRawPtr<TraceEventListener>, InspectorClient*);
- void removeAllListeners(TraceEventTargetBase*, InspectorClient*);
+ void removeAllListeners(void*, InspectorClient*);
void processBackgroundEvents();
private:
- struct BoundTraceEventHandler {
- TraceEventTargetBase* instance;
- TraceEventHandlerMethod method;
-
- BoundTraceEventHandler() : instance(0), method(0) { }
- BoundTraceEventHandler(TraceEventTargetBase* instance, TraceEventHandlerMethod method)
- : instance(instance)
- , method(method)
- {
- }
- };
typedef std::pair<String, int> EventSelector;
- typedef HashMap<EventSelector, Vector<BoundTraceEventHandler> > HandlersMap;
+ typedef WillBeHeapHashMap<EventSelector, OwnPtrWillBeMember<WillBeHeapVector<OwnPtrWillBeMember<TraceEventListener> > > > ListenersMap;
TraceEventDispatcher()
- : m_processEventsTaskInFlight(false)
+ : m_listeners(adoptPtrWillBeNoop(new ListenersMap()))
+ , m_processEventsTaskInFlight(false)
, m_lastEventProcessingTime(0)
{
}
@@ -183,20 +173,15 @@ private:
unsigned char flags, double timestamp);
void enqueueEvent(const TraceEvent&);
- void innerAddListener(const char* name, char phase, TraceEventTargetBase*, TraceEventHandlerMethod, InspectorClient*);
void processBackgroundEventsTask();
Mutex m_mutex;
- HandlersMap m_handlers;
+ OwnPtrWillBePersistent<ListenersMap> m_listeners;
Vector<TraceEvent> m_backgroundEvents;
bool m_processEventsTaskInFlight;
double m_lastEventProcessingTime;
};
-template<typename C> struct TraceEventTarget : public TraceEventTargetBase {
- typedef void (C::*TraceEventHandler)(const TraceEventDispatcher::TraceEvent&);
-};
-
} // namespace blink
#endif // TraceEventDispatcher_h
« no previous file with comments | « Source/core/inspector/PageRuntimeAgent.cpp ('k') | Source/core/inspector/TraceEventDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698