• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef TOOLS_GN_POOL_H_
6 #define TOOLS_GN_POOL_H_
7 
8 #include <string>
9 
10 #include "base/macros.h"
11 #include "gn/item.h"
12 
13 // Represents a named pool in the dependency graph.
14 //
15 // A pool is used to limit the parallelism of task invocation in the
16 // generated ninja build. Pools are referenced by toolchains.
17 class Pool : public Item {
18  public:
19   using Item::Item;
20   ~Pool() override;
21 
22   // Item implementation.
23   Pool* AsPool() override;
24   const Pool* AsPool() const override;
25 
26   // The pool depth (number of task to run simultaneously).
depth()27   int64_t depth() const { return depth_; }
set_depth(int64_t depth)28   void set_depth(int64_t depth) { depth_ = depth; }
29 
30   // The pool name in generated ninja files.
31   std::string GetNinjaName(const Label& default_toolchain) const;
32 
33  private:
34   std::string GetNinjaName(bool include_toolchain) const;
35 
36   int64_t depth_ = 0;
37 
38   DISALLOW_COPY_AND_ASSIGN(Pool);
39 };
40 
41 #endif  // TOOLS_GN_POOL_H_
42