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

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

Issue 1468173003: [Tracing Clock Sync] Add TracingAgent interface in Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix Created 5 years 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_POWER_TRACING_AGENT_H_ 5 #ifndef CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
6 #define CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ 6 #define CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
7 7
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "base/trace_event/tracing_agent.h"
10 11
11 namespace base { 12 namespace base {
12 template <typename Type> 13 template <typename Type>
13 struct DefaultSingletonTraits; 14 struct DefaultSingletonTraits;
14 } // namespace base 15 } // namespace base
15 16
16 namespace content { 17 namespace content {
17 18
18 class BattorPowerTraceProvider; 19 class BattorPowerTraceProvider;
19 20
20 class PowerTracingAgent { 21 class PowerTracingAgent : public base::trace_event::TracingAgent {
21 public: 22 public:
22 typedef base::Callback<void(const scoped_refptr<base::RefCountedString>&)>
23 OutputCallback;
24
25 bool StartTracing();
26 void StopTracing(const OutputCallback& callback);
27
28 // Retrieve the singleton instance. 23 // Retrieve the singleton instance.
29 static PowerTracingAgent* GetInstance(); 24 static PowerTracingAgent* GetInstance();
30 25
26 // base::trace_event::TracingAgent implementation.
27 std::string GetTracingAgentName() override;
28 std::string GetTraceEventLabel() override;
29
30 bool StartAgentTracing(
31 const base::trace_event::TraceConfig& trace_config) override;
32 void StopAgentTracing(const StopAgentTracingCallback& callback) override;
33
34 bool SupportsExplicitClockSync() override;
35 void RecordClockSyncMarker(
36 int sync_id,
37 const RecordClockSyncMarkerCallback& callback) override;
38
31 private: 39 private:
32 // This allows constructor and destructor to be private and usable only 40 // This allows constructor and destructor to be private and usable only
33 // by the Singleton class. 41 // by the Singleton class.
34 friend struct base::DefaultSingletonTraits<PowerTracingAgent>; 42 friend struct base::DefaultSingletonTraits<PowerTracingAgent>;
35 43
36 // Constructor. 44 // Constructor.
37 PowerTracingAgent(); 45 PowerTracingAgent();
38 virtual ~PowerTracingAgent(); 46 ~PowerTracingAgent() override;
39 47
40 void OnStopTracingDone(const OutputCallback& callback, 48 void OnStopTracingDone(const StopAgentTracingCallback& callback,
41 const scoped_refptr<base::RefCountedString>& result); 49 const scoped_refptr<base::RefCountedString>& result);
42 50
43 void FlushOnThread(const OutputCallback& callback); 51 void FlushOnThread(const StopAgentTracingCallback& callback);
44 52
45 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_; 53 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_;
46 bool is_tracing_; 54 bool is_tracing_;
47 55
48 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent); 56 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent);
49 }; 57 };
50 58
51 } // namespace content 59 } // namespace content
52 60
53 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ 61 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
OLDNEW
« no previous file with comments | « content/browser/tracing/etw_system_event_consumer_win.cc ('k') | content/browser/tracing/power_tracing_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698