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_TOOLCHAIN_H_ | 5 #ifndef TOOLS_GN_TOOLCHAIN_H_ |
6 #define TOOLS_GN_TOOLCHAIN_H_ | 6 #define TOOLS_GN_TOOLCHAIN_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
11 #include "tools/gn/item.h" | 12 #include "tools/gn/item.h" |
12 #include "tools/gn/label_ptr.h" | 13 #include "tools/gn/label_ptr.h" |
13 #include "tools/gn/scope.h" | 14 #include "tools/gn/scope.h" |
14 #include "tools/gn/source_file_type.h" | 15 #include "tools/gn/source_file_type.h" |
15 #include "tools/gn/substitution_type.h" | 16 #include "tools/gn/substitution_type.h" |
16 #include "tools/gn/tool.h" | 17 #include "tools/gn/tool.h" |
17 #include "tools/gn/value.h" | 18 #include "tools/gn/value.h" |
18 | 19 |
19 // Holds information on a specific toolchain. This data is filled in when we | 20 // Holds information on a specific toolchain. This data is filled in when we |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 // Returns TYPE_NONE on failure. | 76 // Returns TYPE_NONE on failure. |
76 static ToolType ToolNameToType(const base::StringPiece& str); | 77 static ToolType ToolNameToType(const base::StringPiece& str); |
77 static std::string ToolTypeToName(ToolType type); | 78 static std::string ToolTypeToName(ToolType type); |
78 | 79 |
79 // Returns null if the tool hasn't been defined. | 80 // Returns null if the tool hasn't been defined. |
80 const Tool* GetTool(ToolType type) const; | 81 const Tool* GetTool(ToolType type) const; |
81 | 82 |
82 // Set a tool. When all tools are configured, you should call | 83 // Set a tool. When all tools are configured, you should call |
83 // ToolchainSetupComplete(). | 84 // ToolchainSetupComplete(). |
84 void SetTool(ToolType type, scoped_ptr<Tool> t); | 85 void SetTool(ToolType type, std::unique_ptr<Tool> t); |
85 | 86 |
86 // Does final setup on the toolchain once all tools are known. | 87 // Does final setup on the toolchain once all tools are known. |
87 void ToolchainSetupComplete(); | 88 void ToolchainSetupComplete(); |
88 | 89 |
89 // Targets that must be resolved before compiling any targets. | 90 // Targets that must be resolved before compiling any targets. |
90 const LabelTargetVector& deps() const { return deps_; } | 91 const LabelTargetVector& deps() const { return deps_; } |
91 LabelTargetVector& deps() { return deps_; } | 92 LabelTargetVector& deps() { return deps_; } |
92 | 93 |
93 // Specifies build argument overrides that will be set on the base scope. It | 94 // Specifies build argument overrides that will be set on the base scope. It |
94 // will be as if these arguments were passed in on the command line. This | 95 // will be as if these arguments were passed in on the command line. This |
(...skipping 15 matching lines...) Expand all Loading... |
110 | 111 |
111 const SubstitutionBits& substitution_bits() const { | 112 const SubstitutionBits& substitution_bits() const { |
112 DCHECK(setup_complete_); | 113 DCHECK(setup_complete_); |
113 return substitution_bits_; | 114 return substitution_bits_; |
114 } | 115 } |
115 | 116 |
116 void set_concurrent_links(int cl) { concurrent_links_ = cl; } | 117 void set_concurrent_links(int cl) { concurrent_links_ = cl; } |
117 int concurrent_links() const { return concurrent_links_; } | 118 int concurrent_links() const { return concurrent_links_; } |
118 | 119 |
119 private: | 120 private: |
120 scoped_ptr<Tool> tools_[TYPE_NUMTYPES]; | 121 std::unique_ptr<Tool> tools_[TYPE_NUMTYPES]; |
121 | 122 |
122 // How many links to run in parallel. Only the default toolchain's version of | 123 // How many links to run in parallel. Only the default toolchain's version of |
123 // this variable applies. | 124 // this variable applies. |
124 int concurrent_links_; | 125 int concurrent_links_; |
125 | 126 |
126 bool setup_complete_; | 127 bool setup_complete_; |
127 | 128 |
128 // Substitutions used by the tools in this toolchain. | 129 // Substitutions used by the tools in this toolchain. |
129 SubstitutionBits substitution_bits_; | 130 SubstitutionBits substitution_bits_; |
130 | 131 |
131 LabelTargetVector deps_; | 132 LabelTargetVector deps_; |
132 Scope::KeyValueMap args_; | 133 Scope::KeyValueMap args_; |
133 }; | 134 }; |
134 | 135 |
135 #endif // TOOLS_GN_TOOLCHAIN_H_ | 136 #endif // TOOLS_GN_TOOLCHAIN_H_ |
OLD | NEW |