| 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 namespace base { |
| 15 template <typename Type> | 16 template <typename Type> |
| 16 struct DefaultSingletonTraits; | 17 struct DefaultSingletonTraits; |
| 18 } |
| 17 | 19 |
| 18 namespace content { | 20 namespace content { |
| 19 | 21 |
| 20 class EtwSystemEventConsumer : | 22 class EtwSystemEventConsumer : |
| 21 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { | 23 public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer> { |
| 22 public: | 24 public: |
| 23 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> | 25 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)> |
| 24 OutputCallback; | 26 OutputCallback; |
| 25 | 27 |
| 26 bool StartSystemTracing(); | 28 bool StartSystemTracing(); |
| 27 void StopSystemTracing(const OutputCallback& callback); | 29 void StopSystemTracing(const OutputCallback& callback); |
| 28 | 30 |
| 29 // Retrieve the ETW consumer instance. | 31 // Retrieve the ETW consumer instance. |
| 30 static EtwSystemEventConsumer* GetInstance(); | 32 static EtwSystemEventConsumer* GetInstance(); |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 // This allows constructor and destructor to be private and usable only | 35 // This allows constructor and destructor to be private and usable only |
| 34 // by the Singleton class. | 36 // by the Singleton class. |
| 35 friend struct DefaultSingletonTraits<EtwSystemEventConsumer>; | 37 friend struct base::DefaultSingletonTraits<EtwSystemEventConsumer>; |
| 36 | 38 |
| 37 // Constructor. | 39 // Constructor. |
| 38 EtwSystemEventConsumer(); | 40 EtwSystemEventConsumer(); |
| 39 virtual ~EtwSystemEventConsumer(); | 41 virtual ~EtwSystemEventConsumer(); |
| 40 | 42 |
| 41 void AddSyncEventToBuffer(); | 43 void AddSyncEventToBuffer(); |
| 42 void AppendEventToBuffer(EVENT_TRACE* event); | 44 void AppendEventToBuffer(EVENT_TRACE* event); |
| 43 | 45 |
| 44 // Static override of EtwTraceConsumerBase::ProcessEvent. | 46 // Static override of EtwTraceConsumerBase::ProcessEvent. |
| 45 // @param event the raw ETW event to process. | 47 // @param event the raw ETW event to process. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 66 base::Thread thread_; | 68 base::Thread thread_; |
| 67 TRACEHANDLE session_handle_; | 69 TRACEHANDLE session_handle_; |
| 68 base::win::EtwTraceProperties properties_; | 70 base::win::EtwTraceProperties properties_; |
| 69 | 71 |
| 70 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer); | 72 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer); |
| 71 }; | 73 }; |
| 72 | 74 |
| 73 } // namespace content | 75 } // namespace content |
| 74 | 76 |
| 75 #endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ | 77 #endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_ |
| OLD | NEW |