OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // | 51 // |
52 // Example signature: | 52 // Example signature: |
53 // extern "C" int __declspec(dllexport) FooBar() { | 53 // extern "C" int __declspec(dllexport) FooBar() { |
54 // // do client work here | 54 // // do client work here |
55 // } | 55 // } |
56 // | 56 // |
57 // Returns the handle to the child, or NULL on failure | 57 // Returns the handle to the child, or NULL on failure |
58 ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start); | 58 ProcessHandle SpawnChild(const std::string& procname, bool debug_on_start); |
59 | 59 |
60 #if defined(OS_POSIX) | 60 #if defined(OS_POSIX) |
| 61 // TODO(evan): see if we can delete this via more refactoring. |
| 62 // SpawnChild() should just take a base::LaunchOptions so that we don't |
| 63 // need multiple versions of it. |
61 ProcessHandle SpawnChild(const std::string& procname, | 64 ProcessHandle SpawnChild(const std::string& procname, |
62 const file_handle_mapping_vector& fds_to_map, | 65 const file_handle_mapping_vector& fds_to_map, |
63 bool debug_on_start); | 66 bool debug_on_start); |
64 #endif | 67 #endif |
65 | 68 |
66 // Set up the command line used to spawn the child process. | 69 // Set up the command line used to spawn the child process. |
67 virtual CommandLine MakeCmdLine(const std::string& procname, | 70 virtual CommandLine MakeCmdLine(const std::string& procname, |
68 bool debug_on_start); | 71 bool debug_on_start); |
69 | 72 |
70 private: | 73 private: |
71 #if defined(OS_WIN) | 74 // Shared implementation of SpawnChild. |
72 ProcessHandle SpawnChildImpl(const std::string& procname, | 75 // TODO: |fds_to_map| is unused on Windows; see above TODO about |
73 bool debug_on_start); | 76 // further refactoring. |
74 | |
75 #elif defined(OS_POSIX) | |
76 // TODO(port): with the CommandLine refactoring, this code is very similar | |
77 // to the Windows code. Investigate whether this can be made shorter. | |
78 ProcessHandle SpawnChildImpl(const std::string& procname, | 77 ProcessHandle SpawnChildImpl(const std::string& procname, |
79 const file_handle_mapping_vector& fds_to_map, | 78 const file_handle_mapping_vector& fds_to_map, |
80 bool debug_on_start); | 79 bool debug_on_start); |
81 #endif | |
82 | 80 |
83 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); | 81 DISALLOW_COPY_AND_ASSIGN(MultiProcessTest); |
84 }; | 82 }; |
85 | 83 |
86 } // namespace base | 84 } // namespace base |
87 | 85 |
88 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ | 86 #endif // BASE_TEST_MULTIPROCESS_TEST_H_ |
OLD | NEW |