Chromium Code Reviews| Index: content/browser/tracing/tracing_consumer_win.h |
| diff --git a/content/browser/tracing/tracing_consumer_win.h b/content/browser/tracing/tracing_consumer_win.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0b4c8645f758cca147f133f3b50cbf43d3dc233a |
| --- /dev/null |
| +++ b/content/browser/tracing/tracing_consumer_win.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_ |
| +#define CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_ |
| + |
| +#include "base/bind.h" |
| +#include "base/memory/ref_counted_memory.h" |
| +#include "base/threading/thread.h" |
| +#include "base/values.h" |
| +#include "base/win/event_trace_consumer.h" |
| +#include "base/win/event_trace_controller.h" |
| + |
| +namespace content { |
| + |
| +class EtwSystemEventConsumer : |
| + public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { |
| + public: |
| + typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
| + OutputCallback; |
| + |
| + // Constructor. |
| + EtwSystemEventConsumer(); |
|
nduca
2014/02/20 07:04:54
if its a singleton the constructor should be priva
etienneb
2014/02/20 19:08:03
Done.
|
| + |
|
nduca
2014/02/20 07:04:54
you need a private virtual destructor, even if its
etienneb
2014/02/20 19:08:03
Done.
|
| + // Request the ETW trace controller to activate the kernel tracing. |
| + // returns true on success, false if the kernel tracing isn't activated. |
| + bool StartKernelSessionTracing(); |
| + |
| + // Request the ETW trace controller to deactivate the kernel tracing. |
| + // returns true on success, false if an error occurred. |
| + bool StopKernelSessionTracing(); |
| + |
| + // Send a request to the ETWConsumerThread to consume the kernel events. |
| + void RequestStartTraceConsuming(); |
|
nduca
2014/02/20 07:04:54
my request to keep this internal to the file remai
etienneb
2014/02/20 19:08:03
Done.
|
| + |
| + // Send a request to the ETWConsumerThread to stop consuming the kernel |
| + // events. |
| + // @param callback the callback to call with the consuming result. |
| + void RequestStopTraceConsuming(const OutputCallback& callback); |
| + |
| + // Retrieve the ETW consumer instance. |
|
nduca
2014/02/20 07:04:54
forgive me if i asked this once but can't we use t
etienneb
2014/02/20 19:08:03
Done.
|
| + static EtwSystemEventConsumer* Get(); |
| + |
| + // Static override of EtwTraceConsumerBase::ProcessEvent. |
| + // @param event the raw ETW event to process. |
| + static void ProcessEvent(EVENT_TRACE* event); |
| + |
| + private: |
| + void AppendEventToBuffer(EVENT_TRACE* event); |
| + |
| + void TraceAndConsumeOnThread(); |
| + void StopAndFlushOnThread(const OutputCallback& callback); |
| + |
| + scoped_ptr<base::ListValue> events_; |
| + base::Thread thread_; |
| + TRACEHANDLE session_handle_; |
| + base::win::EtwTraceProperties properties_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_TRACING_TRACING_CONSUMER_WIN_H_ |