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 11 matching lines...) Expand all Loading... |
22 class Subprocess { | 22 class Subprocess { |
23 public: | 23 public: |
24 static void Init() { | 24 static void Init() { |
25 CHECK(!subprocess_singleton_); | 25 CHECK(!subprocess_singleton_); |
26 subprocess_singleton_ = new Subprocess; | 26 subprocess_singleton_ = new Subprocess; |
27 } | 27 } |
28 | 28 |
29 typedef void(*ExecCallback)(int return_code, void *p); | 29 typedef void(*ExecCallback)(int return_code, void *p); |
30 | 30 |
31 // Returns a tag > 0 on success. | 31 // Returns a tag > 0 on success. |
32 uint32 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 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 SynchronousExec(const std::vector<std::string>& cmd, | 40 static bool SynchronousExec(const std::vector<std::string>& cmd, |
41 int* return_code); | 41 int* return_code); |
42 | 42 |
43 // Gets the one instance | 43 // Gets the one instance |
44 static Subprocess& Get() { | 44 static Subprocess& Get() { |
45 return *subprocess_singleton_; | 45 return *subprocess_singleton_; |
46 } | 46 } |
47 | 47 |
(...skipping 22 matching lines...) Expand all Loading... |
70 | 70 |
71 std::map<int, SubprocessCallbackRecord> callback_records_; | 71 std::map<int, SubprocessCallbackRecord> callback_records_; |
72 | 72 |
73 Subprocess() {} | 73 Subprocess() {} |
74 DISALLOW_COPY_AND_ASSIGN(Subprocess); | 74 DISALLOW_COPY_AND_ASSIGN(Subprocess); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace chromeos_update_engine | 77 } // namespace chromeos_update_engine |
78 | 78 |
79 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 79 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
OLD | NEW |