| 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 #ifndef TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ | 5 #ifndef TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ |
| 6 #define TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ | 6 #define TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Tells the BattOr to start tracing. | 48 // Tells the BattOr to start tracing. |
| 49 void StartTracing(); | 49 void StartTracing(); |
| 50 | 50 |
| 51 // Returns whether the BattOr is able to record clock sync markers in its own | 51 // Returns whether the BattOr is able to record clock sync markers in its own |
| 52 // trace log. | 52 // trace log. |
| 53 static bool SupportsExplicitClockSync() { return true; } | 53 static bool SupportsExplicitClockSync() { return true; } |
| 54 | 54 |
| 55 // BattOrConnection::Listener implementations. | 55 // BattOrConnection::Listener implementations. |
| 56 void OnConnectionOpened(bool success) override; | 56 void OnConnectionOpened(bool success) override; |
| 57 void OnBytesSent(bool success) override; | 57 void OnBytesSent(bool success) override; |
| 58 void OnBytesRead(bool success, | 58 void OnMessageRead(bool success, |
| 59 BattOrMessageType type, | 59 BattOrMessageType type, |
| 60 scoped_ptr<std::vector<char>> bytes) override; | 60 scoped_ptr<std::vector<char>> bytes) override; |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 // The connection that knows how to communicate with the BattOr in terms of | 63 // The connection that knows how to communicate with the BattOr in terms of |
| 64 // protocol primitives. This is protected so that it can be replaced with a | 64 // protocol primitives. This is protected so that it can be replaced with a |
| 65 // fake in testing. | 65 // fake in testing. |
| 66 scoped_ptr<BattOrConnection> connection_; | 66 scoped_ptr<BattOrConnection> connection_; |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 enum class Command { | 69 enum class Command { |
| 70 INVALID, | 70 INVALID, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 // Checker to make sure that this is only ever called on the IO thread. | 116 // Checker to make sure that this is only ever called on the IO thread. |
| 117 base::ThreadChecker thread_checker_; | 117 base::ThreadChecker thread_checker_; |
| 118 | 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); | 119 DISALLOW_COPY_AND_ASSIGN(BattOrAgent); |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace battor | 122 } // namespace battor |
| 123 | 123 |
| 124 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ | 124 #endif // TOOLS_BATTOR_AGENT_BATTOR_AGENT_H_ |
| OLD | NEW |