Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/callback_forward.h" | |
| 7 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 8 | 10 |
| 9 namespace battor { | 11 namespace battor { |
| 10 | 12 |
| 11 class BattOrAgent { | 13 class BattOrAgent { |
| 12 public: | 14 public: |
| 13 explicit BattOrAgent(const std::string& path); | 15 explicit BattOrAgent(const std::string& path); |
| 14 virtual ~BattOrAgent(); | 16 virtual ~BattOrAgent(); |
| 15 | 17 |
| 16 // Tells the BattOr to start tracing. | 18 // Tells the BattOr (using a best-effort signal) to start tracing. |
| 17 void StartTracing(); | 19 void StartTracing(); |
| 18 | 20 |
| 19 // Tells the BattOr to stop tracing and returns the trace contents. | 21 // Tells the BattOr to stop tracing and calls the callback when the |
| 20 void StopTracing(std::string* out_trace); | 22 // trace output is available. |
| 23 void StopTracing( | |
| 24 const base::Callback<void(scoped_ptr<std::string>)>& callback); | |
| 21 | 25 |
| 22 // Tells the BattOr to record a clock sync marker in its own trace log. | 26 // Tells the BattOr (using a best-effort signal) to record a clock |
| 27 // sync marker in its own trace log. | |
| 23 void RecordClockSyncMarker(const std::string& marker); | 28 void RecordClockSyncMarker(const std::string& marker); |
|
Zhen Wang
2015/10/29 19:40:22
I think we still need asynchronous call for this b
| |
| 24 | 29 |
| 25 // Tells the BattOr to issue clock sync markers to all other tracing | 30 // Tells the BattOr (using a best-effort signal) to issue clock sync |
| 26 // agents that it's connected to. | 31 // markers to all other tracing agents that it's connected to. |
| 27 void IssueClockSyncMarker(); | 32 void IssueClockSyncMarker(); |
| 28 | 33 |
| 29 // Returns whether the BattOr is able to record clock sync markers | 34 // Returns whether the BattOr is able to record clock sync markers |
| 30 // in its own trace log. | 35 // in its own trace log. |
| 31 static bool SupportsExplicitClockSync() { return true; } | 36 static bool SupportsExplicitClockSync() { return true; } |
| 32 | 37 |
| 33 private: | 38 private: |
| 34 std::string path_; | 39 std::string path_; |
| 35 | 40 |
| 36 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); | 41 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); |
| 37 }; | 42 }; |
| 38 | 43 |
| 39 } // namespace battor | 44 } // namespace battor |
| OLD | NEW |