| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ |
| 6 #define CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ | 6 #define CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "base/win/event_trace_consumer.h" | 12 #include "base/win/event_trace_consumer.h" |
| 13 #include "base/win/event_trace_controller.h" | 13 #include "base/win/event_trace_controller.h" |
| 14 | 14 |
| 15 template <typename Type> | 15 template <typename Type> |
| 16 struct DefaultSingletonTraits; | 16 struct base::DefaultSingletonTraits; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class EtwSystemEventConsumer : | 20 class EtwSystemEventConsumer : |
| 21 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { | 21 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { |
| 22 public: | 22 public: |
| 23 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> | 23 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
| 24 OutputCallback; | 24 OutputCallback; |
| 25 | 25 |
| 26 bool StartSystemTracing(); | 26 bool StartSystemTracing(); |
| 27 void StopSystemTracing(const OutputCallback& callback); | 27 void StopSystemTracing(const OutputCallback& callback); |
| 28 | 28 |
| 29 // Retrieve the ETW consumer instance. | 29 // Retrieve the ETW consumer instance. |
| 30 static EtwSystemEventConsumer* GetInstance(); | 30 static EtwSystemEventConsumer* GetInstance(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // This allows constructor and destructor to be private and usable only | 33 // This allows constructor and destructor to be private and usable only |
| 34 // by the Singleton class. | 34 // by the Singleton class. |
| 35 friend struct DefaultSingletonTraits<EtwSystemEventConsumer>; | 35 friend struct base::DefaultSingletonTraits<EtwSystemEventConsumer>; |
| 36 | 36 |
| 37 // Constructor. | 37 // Constructor. |
| 38 EtwSystemEventConsumer(); | 38 EtwSystemEventConsumer(); |
| 39 virtual ~EtwSystemEventConsumer(); | 39 virtual ~EtwSystemEventConsumer(); |
| 40 | 40 |
| 41 void AddSyncEventToBuffer(); | 41 void AddSyncEventToBuffer(); |
| 42 void AppendEventToBuffer(EVENT_TRACE* event); | 42 void AppendEventToBuffer(EVENT_TRACE* event); |
| 43 | 43 |
| 44 // Static override of EtwTraceConsumerBase::ProcessEvent. | 44 // Static override of EtwTraceConsumerBase::ProcessEvent. |
| 45 // @param event the raw ETW event to process. | 45 // @param event the raw ETW event to process. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 base::Thread thread_; | 66 base::Thread thread_; |
| 67 TRACEHANDLE session_handle_; | 67 TRACEHANDLE session_handle_; |
| 68 base::win::EtwTraceProperties properties_; | 68 base::win::EtwTraceProperties properties_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer); | 70 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 } // namespace content | 73 } // namespace content |
| 74 | 74 |
| 75 #endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ | 75 #endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ |
| OLD | NEW |