OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PARALLEL_TEST_LAUNCHER_H_ | 5 #ifndef BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ |
6 #define BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ | 6 #define BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 size_t sequence_number, | 73 size_t sequence_number, |
74 const LaunchChildGTestProcessCallback& callback, | 74 const LaunchChildGTestProcessCallback& callback, |
75 int exit_code, | 75 int exit_code, |
76 const TimeDelta& elapsed_time, | 76 const TimeDelta& elapsed_time, |
77 bool was_timeout, | 77 bool was_timeout, |
78 const std::string& output); | 78 const std::string& output); |
79 | 79 |
80 // Called by the delay timer when no output was made for a while. | 80 // Called by the delay timer when no output was made for a while. |
81 void OnOutputTimeout(); | 81 void OnOutputTimeout(); |
82 | 82 |
| 83 // Make sure we don't accidentally call the wrong methods e.g. on the worker |
| 84 // pool thread. With lots of callbacks used this is non-trivial. |
| 85 // Should be the first member so that it's destroyed last: when destroying |
| 86 // other members, especially the worker pool, we may check the code is running |
| 87 // on the correct thread. |
| 88 ThreadChecker thread_checker_; |
| 89 |
83 // Watchdog timer to make sure we do not go without output for too long. | 90 // Watchdog timer to make sure we do not go without output for too long. |
84 DelayTimer<ParallelTestLauncher> timer_; | 91 DelayTimer<ParallelTestLauncher> timer_; |
85 | 92 |
86 // Monotonically increasing sequence number to uniquely identify each | 93 // Monotonically increasing sequence number to uniquely identify each |
87 // launched child process. | 94 // launched child process. |
88 size_t launch_sequence_number_; | 95 size_t launch_sequence_number_; |
89 | 96 |
90 // Map of currently running child processes, keyed by the sequence number. | 97 // Map of currently running child processes, keyed by the sequence number. |
91 typedef std::map<size_t, CommandLine> RunningProcessesMap; | 98 typedef std::map<size_t, CommandLine> RunningProcessesMap; |
92 RunningProcessesMap running_processes_map_; | 99 RunningProcessesMap running_processes_map_; |
93 | 100 |
94 // Worker pool used to launch processes in parallel. | 101 // Worker pool used to launch processes in parallel. |
95 scoped_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; | 102 scoped_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; |
96 | 103 |
97 // Make sure we don't accidentally call the wrong methods e.g. on the worker | |
98 // pool thread. With lots of callbacks used this is non-trivial. | |
99 ThreadChecker thread_checker_; | |
100 | |
101 DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher); | 104 DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher); |
102 }; | 105 }; |
103 | 106 |
104 } // namespace base | 107 } // namespace base |
105 | 108 |
106 #endif // BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ | 109 #endif // BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ |
OLD | NEW |