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 #include "tools/gn/toolchain.h" | 5 #include "tools/gn/toolchain.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 case TYPE_STAMP: return kToolStamp; | 79 case TYPE_STAMP: return kToolStamp; |
80 case TYPE_COPY: return kToolCopy; | 80 case TYPE_COPY: return kToolCopy; |
81 case TYPE_COPY_BUNDLE_DATA: return kToolCopyBundleData; | 81 case TYPE_COPY_BUNDLE_DATA: return kToolCopyBundleData; |
82 case TYPE_COMPILE_XCASSETS: return kToolCompileXCAssets; | 82 case TYPE_COMPILE_XCASSETS: return kToolCompileXCAssets; |
83 default: | 83 default: |
84 NOTREACHED(); | 84 NOTREACHED(); |
85 return std::string(); | 85 return std::string(); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
| 89 Tool* Toolchain::GetTool(ToolType type) { |
| 90 DCHECK(type != TYPE_NONE); |
| 91 return tools_[static_cast<size_t>(type)].get(); |
| 92 } |
| 93 |
89 const Tool* Toolchain::GetTool(ToolType type) const { | 94 const Tool* Toolchain::GetTool(ToolType type) const { |
90 DCHECK(type != TYPE_NONE); | 95 DCHECK(type != TYPE_NONE); |
91 return tools_[static_cast<size_t>(type)].get(); | 96 return tools_[static_cast<size_t>(type)].get(); |
92 } | 97 } |
93 | 98 |
94 void Toolchain::SetTool(ToolType type, std::unique_ptr<Tool> t) { | 99 void Toolchain::SetTool(ToolType type, std::unique_ptr<Tool> t) { |
95 DCHECK(type != TYPE_NONE); | 100 DCHECK(type != TYPE_NONE); |
96 DCHECK(!tools_[type].get()); | 101 DCHECK(!tools_[type].get()); |
97 t->SetComplete(); | 102 t->SetComplete(); |
98 tools_[type] = std::move(t); | 103 tools_[type] = std::move(t); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 return TYPE_STAMP; | 170 return TYPE_STAMP; |
166 default: | 171 default: |
167 NOTREACHED(); | 172 NOTREACHED(); |
168 return Toolchain::TYPE_NONE; | 173 return Toolchain::TYPE_NONE; |
169 } | 174 } |
170 } | 175 } |
171 | 176 |
172 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const { | 177 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const { |
173 return tools_[GetToolTypeForTargetFinalOutput(target)].get(); | 178 return tools_[GetToolTypeForTargetFinalOutput(target)].get(); |
174 } | 179 } |
OLD | NEW |