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

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 std::string GetTracingAgentName() override;
Primiano Tucci (use gerrit) 2015/12/01 11:42:43 Typically you want to add a comment like: // base
Zhen Wang 2015/12/01 18:02:53 Done.
27 std::string GetTraceEventLabel() override;
28
29 bool StartAgentTracing(
30 const base::trace_event::TraceConfig& trace_config) override;
31 void StopAgentTracing(const StopAgentTracingCallback& callback) override;
32
33 bool SupportsExplicitClockSync() override;
34 void RecordClockSyncMarker(scoped_ptr<base::DictionaryValue> marker) override;
35 void IssueClockSyncMarker() override;
36
31 private: 37 private:
32 // This allows constructor and destructor to be private and usable only 38 // This allows constructor and destructor to be private and usable only
33 // by the Singleton class. 39 // by the Singleton class.
34 friend struct base::DefaultSingletonTraits<PowerTracingAgent>; 40 friend struct base::DefaultSingletonTraits<PowerTracingAgent>;
35 41
36 // Constructor. 42 // Constructor.
37 PowerTracingAgent(); 43 PowerTracingAgent();
38 virtual ~PowerTracingAgent(); 44 ~PowerTracingAgent() override;
39 45
40 void OnStopTracingDone(const OutputCallback& callback, 46 void OnStopTracingDone(const StopAgentTracingCallback& callback,
41 const scoped_refptr<base::RefCountedString>& result); 47 const scoped_refptr<base::RefCountedString>& result);
42 48
43 void FlushOnThread(const OutputCallback& callback); 49 void FlushOnThread(const StopAgentTracingCallback& callback);
44 50
45 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_; 51 scoped_ptr<BattorPowerTraceProvider> battor_trace_provider_;
46 bool is_tracing_; 52 bool is_tracing_;
47 53
48 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent); 54 DISALLOW_COPY_AND_ASSIGN(PowerTracingAgent);
49 }; 55 };
50 56
51 } // namespace content 57 } // namespace content
52 58
53 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_ 59 #endif // CONTENT_BROWSER_TRACING_POWER_TRACING_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698