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

Side by Side Diff: content/browser/tracing/etw_system_event_consumer_win.h

Issue 1908373003: Rename EtwSystemEventConsumerWin to EtwTracingAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_
6 #define CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_
7
8 #include <memory>
9
10 #include "base/bind.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted_memory.h"
13 #include "base/threading/thread.h"
14 #include "base/trace_event/tracing_agent.h"
15 #include "base/values.h"
16 #include "base/win/event_trace_consumer.h"
17 #include "base/win/event_trace_controller.h"
18
19 namespace base {
20 template <typename Type>
21 struct DefaultSingletonTraits;
22 }
23
24 namespace content {
25
26 class EtwSystemEventConsumer
27 : public base::win::EtwTraceConsumerBase<EtwSystemEventConsumer>,
28 public base::trace_event::TracingAgent {
29 public:
30 // base::trace_event::TracingAgent implementation.
31 std::string GetTracingAgentName() override;
32 std::string GetTraceEventLabel() override;
33 void StartAgentTracing(const base::trace_event::TraceConfig& trace_config,
34 const StartAgentTracingCallback& callback) override;
35 void StopAgentTracing(const StopAgentTracingCallback& callback) override;
36
37 // Retrieve the ETW consumer instance.
38 static EtwSystemEventConsumer* GetInstance();
39
40 private:
41 // This allows constructor and destructor to be private and usable only
42 // by the Singleton class.
43 friend struct base::DefaultSingletonTraits<EtwSystemEventConsumer>;
44
45 // Constructor.
46 EtwSystemEventConsumer();
47 ~EtwSystemEventConsumer() override;
48
49 void AddSyncEventToBuffer();
50 void AppendEventToBuffer(EVENT_TRACE* event);
51
52 // Static override of EtwTraceConsumerBase::ProcessEvent.
53 // @param event the raw ETW event to process.
54 friend class base::win::EtwTraceConsumerBase<EtwSystemEventConsumer>;
55 static void ProcessEvent(EVENT_TRACE* event);
56
57 // Request the ETW trace controller to activate the kernel tracing.
58 // returns true on success, false if the kernel tracing isn't activated.
59 bool StartKernelSessionTracing();
60
61 // Request the ETW trace controller to deactivate the kernel tracing.
62 // @param callback the callback to call with the consumed events.
63 // @returns true on success, false if an error occurred.
64 bool StopKernelSessionTracing();
65
66 void OnStopSystemTracingDone(
67 const StopAgentTracingCallback& callback,
68 const scoped_refptr<base::RefCountedString>& result);
69
70 void TraceAndConsumeOnThread();
71 void FlushOnThread(const StopAgentTracingCallback& callback);
72
73 std::unique_ptr<base::ListValue> events_;
74 base::Thread thread_;
75 TRACEHANDLE session_handle_;
76 base::win::EtwTraceProperties properties_;
77
78 DISALLOW_COPY_AND_ASSIGN(EtwSystemEventConsumer);
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_BROWSER_TRACING_ETW_SYSTEM_EVENT_CONSUMER_WIN_H_
OLDNEW
« no previous file with comments | « base/trace_event/tracing_agent.h ('k') | content/browser/tracing/etw_system_event_consumer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698