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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 | 15 |
16 class CommandLine; | 16 class CommandLine; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 class SequencedWorkerPool; | 20 class SequencedWorkerPoolOwner; |
21 class Timer; | 21 class Timer; |
22 | 22 |
23 // Launches child gtest process in parallel. Keeps track of running processes, | 23 // Launches child gtest process in parallel. Keeps track of running processes, |
24 // prints a message in case no output is produced for a while. | 24 // prints a message in case no output is produced for a while. |
25 class ParallelTestLauncher { | 25 class ParallelTestLauncher { |
26 public: | 26 public: |
27 // Constructor. |jobs| is the maximum number of tests launched in parallel. | 27 // Constructor. |jobs| is the maximum number of tests launched in parallel. |
28 explicit ParallelTestLauncher(size_t jobs); | 28 explicit ParallelTestLauncher(size_t jobs); |
29 ~ParallelTestLauncher(); | 29 ~ParallelTestLauncher(); |
30 | 30 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Monotonically increasing sequence number to uniquely identify each | 68 // Monotonically increasing sequence number to uniquely identify each |
69 // launched child process. | 69 // launched child process. |
70 size_t launch_sequence_number_; | 70 size_t launch_sequence_number_; |
71 | 71 |
72 // Map of currently running child processes, keyed by the sequence number. | 72 // Map of currently running child processes, keyed by the sequence number. |
73 typedef std::map<size_t, CommandLine> RunningProcessesMap; | 73 typedef std::map<size_t, CommandLine> RunningProcessesMap; |
74 RunningProcessesMap running_processes_map_; | 74 RunningProcessesMap running_processes_map_; |
75 | 75 |
76 // Worker pool used to launch processes in parallel. | 76 // Worker pool used to launch processes in parallel. |
77 scoped_refptr<SequencedWorkerPool> worker_pool_; | 77 scoped_ptr<SequencedWorkerPoolOwner> worker_pool_owner_; |
78 | 78 |
79 // Make sure we don't accidentally call the wrong methods e.g. on the worker | 79 // Make sure we don't accidentally call the wrong methods e.g. on the worker |
80 // pool thread. With lots of callbacks used this is non-trivial. | 80 // pool thread. With lots of callbacks used this is non-trivial. |
81 ThreadChecker thread_checker_; | 81 ThreadChecker thread_checker_; |
82 | 82 |
83 DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher); | 83 DISALLOW_COPY_AND_ASSIGN(ParallelTestLauncher); |
84 }; | 84 }; |
85 | 85 |
86 } // namespace base | 86 } // namespace base |
87 | 87 |
88 #endif // BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ | 88 #endif // BASE_TEST_PARALLEL_TEST_LAUNCHER_H_ |
OLD | NEW |