| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 15 #include "tools/gn/input_file_manager.h" | 15 #include "tools/gn/input_file_manager.h" |
| 16 | 16 |
| 17 class Target; | 17 class Target; |
| 18 | 18 |
| 19 // Maintains the thread pool and error state. | 19 // Maintains the thread pool and error state. |
| 20 class Scheduler { | 20 class Scheduler { |
| 21 public: | 21 public: |
| 22 Scheduler(); | 22 Scheduler(); |
| 23 ~Scheduler(); | 23 ~Scheduler(); |
| 24 | 24 |
| 25 bool Run(); | 25 bool Run(); |
| 26 | 26 |
| 27 base::MessageLoop* main_loop() { return &main_loop_; } | 27 base::MessageLoop* main_loop() { return &main_loop_; } |
| 28 base::SequencedWorkerPool* pool() { return pool_; } | 28 base::SequencedWorkerPool* pool() { return pool_.get(); } |
| 29 | 29 |
| 30 InputFileManager* input_file_manager() { return input_file_manager_; } | 30 InputFileManager* input_file_manager() { return input_file_manager_.get(); } |
| 31 | 31 |
| 32 bool verbose_logging() const { return verbose_logging_; } | 32 bool verbose_logging() const { return verbose_logging_; } |
| 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 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Additional input dependencies. Protected by the lock. | 87 // Additional input dependencies. Protected by the lock. |
| 88 std::vector<base::FilePath> gen_dependencies_; | 88 std::vector<base::FilePath> gen_dependencies_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 90 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 extern Scheduler* g_scheduler; | 93 extern Scheduler* g_scheduler; |
| 94 | 94 |
| 95 #endif // TOOLS_GN_SCHEDULER_H_ | 95 #endif // TOOLS_GN_SCHEDULER_H_ |
| 96 | 96 |
| OLD | NEW |