| 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 // This file provides a thin binary wrapper around the BattOr Agent | 5 // This file provides a thin binary wrapper around the BattOr Agent |
| 6 // library. This binary wrapper provides a means for non-C++ tracing | 6 // library. This binary wrapper provides a means for non-C++ tracing |
| 7 // controllers, such as Telemetry and Android Systrace, to issue high-level | 7 // controllers, such as Telemetry and Android Systrace, to issue high-level |
| 8 // tracing commands to the BattOr through an interactive shell. | 8 // tracing commands to the BattOr through an interactive shell. |
| 9 // | 9 // |
| 10 // Example usage of how an external trace controller might use this binary: | 10 // Example usage of how an external trace controller might use this binary: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } else if (cmd.find("RecordClockSyncMarker") != std::string::npos) { | 184 } else if (cmd.find("RecordClockSyncMarker") != std::string::npos) { |
| 185 std::vector<std::string> tokens = TokenizeString(cmd); | 185 std::vector<std::string> tokens = TokenizeString(cmd); |
| 186 if (tokens.size() != 2 || tokens[0] != "RecordClockSyncMarker") { | 186 if (tokens.size() != 2 || tokens[0] != "RecordClockSyncMarker") { |
| 187 std::cout << "Invalid RecordClockSyncMarker command." << endl; | 187 std::cout << "Invalid RecordClockSyncMarker command." << endl; |
| 188 std::cout << kUsage << endl; | 188 std::cout << kUsage << endl; |
| 189 PostRunNextCommand(); | 189 PostRunNextCommand(); |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 | 192 |
| 193 RecordClockSyncMarker(tokens[1]); | 193 RecordClockSyncMarker(tokens[1]); |
| 194 } else if (cmd == "Exit") { | 194 } else if (cmd == "Exit" || std::cin.eof()) { |
| 195 ui_thread_message_loop_.task_runner()->PostTask( | 195 ui_thread_message_loop_.task_runner()->PostTask( |
| 196 FROM_HERE, ui_thread_run_loop_.QuitClosure()); | 196 FROM_HERE, ui_thread_run_loop_.QuitClosure()); |
| 197 } else { | 197 } else { |
| 198 std::cout << kUsage << endl; | 198 std::cout << kUsage << endl; |
| 199 PostRunNextCommand(); | 199 PostRunNextCommand(); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void PostRunNextCommand() { | 203 void PostRunNextCommand() { |
| 204 ui_thread_message_loop_.task_runner()->PostTask( | 204 ui_thread_message_loop_.task_runner()->PostTask( |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 }; | 306 }; |
| 307 | 307 |
| 308 } // namespace battor | 308 } // namespace battor |
| 309 | 309 |
| 310 int main(int argc, char* argv[]) { | 310 int main(int argc, char* argv[]) { |
| 311 base::AtExitManager exit_manager; | 311 base::AtExitManager exit_manager; |
| 312 base::CommandLine::Init(argc, argv); | 312 base::CommandLine::Init(argc, argv); |
| 313 battor::BattOrAgentBin bin; | 313 battor::BattOrAgentBin bin; |
| 314 return bin.Run(argc, argv); | 314 return bin.Run(argc, argv); |
| 315 } | 315 } |
| OLD | NEW |