| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Returns a tag > 0 on success. | 31 // Returns a tag > 0 on success. |
| 32 uint32_t Exec(const std::vector<std::string>& cmd, | 32 uint32_t Exec(const std::vector<std::string>& cmd, |
| 33 ExecCallback callback, | 33 ExecCallback callback, |
| 34 void* p); | 34 void* p); |
| 35 | 35 |
| 36 // Used to cancel the callback. The process will still run to completion. | 36 // Used to cancel the callback. The process will still run to completion. |
| 37 void CancelExec(uint32_t tag); | 37 void CancelExec(uint32_t tag); |
| 38 | 38 |
| 39 // Executes a command synchronously. Returns true on success. | 39 // Executes a command synchronously. Returns true on success. |
| 40 static bool SynchronousExecFlags(const std::vector<std::string>& cmd, |
| 41 int* return_code, |
| 42 GSpawnFlags flags); |
| 40 static bool SynchronousExec(const std::vector<std::string>& cmd, | 43 static bool SynchronousExec(const std::vector<std::string>& cmd, |
| 41 int* return_code); | 44 int* return_code) { |
| 45 return SynchronousExecFlags(cmd, return_code, static_cast<GSpawnFlags>(0)); |
| 46 } |
| 42 | 47 |
| 43 // Gets the one instance | 48 // Gets the one instance |
| 44 static Subprocess& Get() { | 49 static Subprocess& Get() { |
| 45 return *subprocess_singleton_; | 50 return *subprocess_singleton_; |
| 46 } | 51 } |
| 47 | 52 |
| 48 // Returns true iff there is at least one subprocess we're waiting on. | 53 // Returns true iff there is at least one subprocess we're waiting on. |
| 49 bool SubprocessInFlight() { | 54 bool SubprocessInFlight() { |
| 50 for (std::map<int, SubprocessCallbackRecord>::iterator it = | 55 for (std::map<int, SubprocessCallbackRecord>::iterator it = |
| 51 callback_records_.begin(); | 56 callback_records_.begin(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 74 | 79 |
| 75 std::map<int, SubprocessCallbackRecord> callback_records_; | 80 std::map<int, SubprocessCallbackRecord> callback_records_; |
| 76 | 81 |
| 77 Subprocess() {} | 82 Subprocess() {} |
| 78 DISALLOW_COPY_AND_ASSIGN(Subprocess); | 83 DISALLOW_COPY_AND_ASSIGN(Subprocess); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 } // namespace chromeos_update_engine | 86 } // namespace chromeos_update_engine |
| 82 | 87 |
| 83 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 88 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
| OLD | NEW |