OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_POOL_H_ | 5 #ifndef TOOLS_GN_POOL_H_ |
6 #define TOOLS_GN_POOL_H_ | 6 #define TOOLS_GN_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "tools/gn/item.h" | 10 #include "tools/gn/item.h" |
11 | 11 |
12 // Represents a named pool in the dependency graph. | 12 // Represents a named pool in the dependency graph. |
13 // | 13 // |
14 // A pool is used to limit the parallelism of task invocation in the | 14 // A pool is used to limit the parallelism of task invocation in the |
15 // generated ninja build. Pools are referenced by toolchains. | 15 // generated ninja build. Pools are referenced by toolchains. |
16 class Pool : public Item { | 16 class Pool : public Item { |
17 public: | 17 public: |
18 Pool(const Settings* settings, const Label& label); | 18 using Item::Item; |
19 ~Pool() override; | 19 ~Pool() override; |
20 | 20 |
21 Pool(const Pool&) = delete; | 21 Pool(const Pool&) = delete; |
22 Pool& operator=(const Pool&) = delete; | 22 Pool& operator=(const Pool&) = delete; |
23 | 23 |
24 // Item implementation. | 24 // Item implementation. |
25 Pool* AsPool() override; | 25 Pool* AsPool() override; |
26 const Pool* AsPool() const override; | 26 const Pool* AsPool() const override; |
27 | 27 |
28 // The pool depth (number of task to run simultaneously). | 28 // The pool depth (number of task to run simultaneously). |
29 int64_t depth() const { return depth_; } | 29 int64_t depth() const { return depth_; } |
30 void set_depth(int64_t depth) { depth_ = depth; } | 30 void set_depth(int64_t depth) { depth_ = depth; } |
31 | 31 |
32 // The pool name in generated ninja files. | 32 // The pool name in generated ninja files. |
33 std::string GetNinjaName(const Label& default_toolchain) const; | 33 std::string GetNinjaName(const Label& default_toolchain) const; |
34 | 34 |
35 private: | 35 private: |
36 std::string GetNinjaName(bool include_toolchain) const; | 36 std::string GetNinjaName(bool include_toolchain) const; |
37 | 37 |
38 int64_t depth_ = 0; | 38 int64_t depth_ = 0; |
39 }; | 39 }; |
40 | 40 |
41 #endif // TOOLS_GN_POOL_H_ | 41 #endif // TOOLS_GN_POOL_H_ |
OLD | NEW |