1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_GPU_DEVTOOLS_GPU_INSTRUMENTATION_H_
6 #define CONTENT_COMMON_GPU_DEVTOOLS_GPU_INSTRUMENTATION_H_
10 #include "base/basictypes.h"
11 #include "base/threading/non_thread_safe.h"
15 class DevToolsGpuAgent
;
18 class GpuEventsDispatcher
: public base::NonThreadSafe
{
25 GpuEventsDispatcher();
26 ~GpuEventsDispatcher();
28 void AddProcessor(DevToolsGpuAgent
* processor
);
29 void RemoveProcessor(DevToolsGpuAgent
* processor
);
31 static void FireEvent(EventPhase phase
, GpuChannel
* channel
) {
34 DoFireEvent(phase
, channel
);
38 static bool IsEnabled() { return enabled_
; }
39 static void DoFireEvent(EventPhase
, GpuChannel
* channel
);
42 std::vector
<DevToolsGpuAgent
*> processors_
;
45 namespace devtools_gpu_instrumentation
{
49 explicit ScopedGpuTask(GpuChannel
* channel
) :
51 GpuEventsDispatcher::FireEvent(GpuEventsDispatcher::kEventStart
, channel_
);
54 GpuEventsDispatcher::FireEvent(GpuEventsDispatcher::kEventFinish
, channel_
);
58 DISALLOW_COPY_AND_ASSIGN(ScopedGpuTask
);
61 } // namespace devtools_gpu_instrumentation
63 } // namespace content
65 #endif // CONTENT_COMMON_GPU_DEVTOOLS_GPU_INSTRUMENTATION_H_