OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 TOOLS_GN_SCHEDULER_H_ | 5 #ifndef TOOLS_GN_SCHEDULER_H_ |
6 #define TOOLS_GN_SCHEDULER_H_ | 6 #define TOOLS_GN_SCHEDULER_H_ |
7 | 7 |
8 #include "base/atomic_ref_count.h" | 8 #include "base/atomic_ref_count.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 void set_verbose_logging(bool v) { verbose_logging_ = v; } | 33 void set_verbose_logging(bool v) { verbose_logging_ = v; } |
34 | 34 |
35 // TODO(brettw) data race on this access (benign?). | 35 // TODO(brettw) data race on this access (benign?). |
36 bool is_failed() const { return is_failed_; } | 36 bool is_failed() const { return is_failed_; } |
37 | 37 |
38 void Log(const std::string& verb, const std::string& msg); | 38 void Log(const std::string& verb, const std::string& msg); |
39 void FailWithError(const Err& err); | 39 void FailWithError(const Err& err); |
40 | 40 |
41 void ScheduleWork(const base::Closure& work); | 41 void ScheduleWork(const base::Closure& work); |
42 | 42 |
43 void ScheduleTargetFileWrite(const Target* target); | 43 void Shutdown(); |
44 | 44 |
45 // Declares that the given file was read and affected the build output. | 45 // Declares that the given file was read and affected the build output. |
46 // | 46 // |
47 // TODO(brettw) this is global rather than per-BuildSettings. If we | 47 // TODO(brettw) this is global rather than per-BuildSettings. If we |
48 // start using >1 build settings, then we probably want this to take a | 48 // start using >1 build settings, then we probably want this to take a |
49 // BuildSettings object so we know the depdency on a per-build basis. | 49 // BuildSettings object so we know the depdency on a per-build basis. |
50 void AddGenDependency(const base::FilePath& file); | 50 void AddGenDependency(const base::FilePath& file); |
51 std::vector<base::FilePath> GetGenDependencies() const; | 51 std::vector<base::FilePath> GetGenDependencies() const; |
52 | 52 |
53 // We maintain a count of the things we need to do that works like a | 53 // We maintain a count of the things we need to do that works like a |
(...skipping 18 matching lines...) Expand all Loading... |
72 | 72 |
73 base::RunLoop runner_; | 73 base::RunLoop runner_; |
74 | 74 |
75 bool verbose_logging_; | 75 bool verbose_logging_; |
76 | 76 |
77 base::AtomicRefCount work_count_; | 77 base::AtomicRefCount work_count_; |
78 | 78 |
79 mutable base::Lock lock_; | 79 mutable base::Lock lock_; |
80 bool is_failed_; | 80 bool is_failed_; |
81 | 81 |
| 82 // Used to track whether the worker pool has been shutdown. This is necessary |
| 83 // to clean up after tests that make a scheduler but don't run the message |
| 84 // loop. |
| 85 bool has_been_shutdown_; |
| 86 |
82 // Additional input dependencies. Protected by the lock. | 87 // Additional input dependencies. Protected by the lock. |
83 std::vector<base::FilePath> gen_dependencies_; | 88 std::vector<base::FilePath> gen_dependencies_; |
84 | 89 |
85 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 90 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
86 }; | 91 }; |
87 | 92 |
88 extern Scheduler* g_scheduler; | 93 extern Scheduler* g_scheduler; |
89 | 94 |
90 #endif // TOOLS_GN_SCHEDULER_H_ | 95 #endif // TOOLS_GN_SCHEDULER_H_ |
91 | 96 |
OLD | NEW |