OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_TEST_MULTIPROCESS_TEST_H_ | 5 #ifndef BASE_TEST_MULTIPROCESS_TEST_H_ |
6 #define BASE_TEST_MULTIPROCESS_TEST_H_ | 6 #define BASE_TEST_MULTIPROCESS_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // run. | 49 // run. |
50 // | 50 // |
51 // Example signature: | 51 // Example signature: |
52 // extern "C" int __declspec(dllexport) FooBar() { | 52 // extern "C" int __declspec(dllexport) FooBar() { |
53 // // do client work here | 53 // // do client work here |
54 // } | 54 // } |
55 // | 55 // |
56 // Returns the handle to the child, or NULL on failure | 56 // Returns the handle to the child, or NULL on failure |
57 ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start); | 57 ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start); |
58 | 58 |
| 59 // Run a child process using the given launch options. |
| 60 // |
| 61 // Note: On Windows, you probably want to set |options.start_hidden|. |
| 62 ProcessHandle SpawnChildWithOptions(const std::string& procname, |
| 63 const LaunchOptions& options, |
| 64 bool debug_on_start); |
| 65 |
59 #if defined(OS_POSIX) | 66 #if defined(OS_POSIX) |
60 // TODO(evan): see if we can delete this via more refactoring. | 67 // TODO(vtl): Remove this in favor of |SpawnChildWithOptions()|. Probably keep |
61 // SpawnChild() should just take a base::LaunchOptions so that we don't | 68 // the no-options |SpawnChild()| around for ease-of-use. |
62 // need multiple versions of it. | |
63 ProcessHandle SpawnChild(const std::string& procname, | 69 ProcessHandle SpawnChild(const std::string& procname, |
64 const FileHandleMappingVector& fds_to_map, | 70 const FileHandleMappingVector& fds_to_map, |
65 bool debug_on_start); | 71 bool debug_on_start); |
66 #endif | 72 #endif |
67 | 73 |
68 // Set up the command line used to spawn the child process. | 74 // Set up the command line used to spawn the child process. |
69 virtual CommandLine MakeCmdLine(const std::string& procname, | 75 virtual CommandLine MakeCmdLine(const std::string& procname, |
70 bool debug_on_start); | 76 bool debug_on_start); |
71 | 77 |
72 private: | 78 private: |
73 // Shared implementation of SpawnChild. | |
74 // TODO: |fds_to_map| is unused on Windows; see above TODO about | |
75 // further refactoring. | |
76 ProcessHandle SpawnChildImpl(const std::string& procname, | |
77 const FileHandleMappingVector& fds_to_map, | |
78 bool debug_on_start); | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); | 79 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); |
81 }; | 80 }; |
82 | 81 |
83 } // namespace base | 82 } // namespace base |
84 | 83 |
85 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ | 84 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ |
OLD | NEW |