Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: tools/gn/toolchain.cc

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/toolchain.h ('k') | tools/gn/value.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 NOTREACHED(); 84 NOTREACHED();
85 return std::string(); 85 return std::string();
86 } 86 }
87 } 87 }
88 88
89 const Tool* Toolchain::GetTool(ToolType type) const { 89 const Tool* Toolchain::GetTool(ToolType type) const {
90 DCHECK(type != TYPE_NONE); 90 DCHECK(type != TYPE_NONE);
91 return tools_[static_cast<size_t>(type)].get(); 91 return tools_[static_cast<size_t>(type)].get();
92 } 92 }
93 93
94 void Toolchain::SetTool(ToolType type, scoped_ptr<Tool> t) { 94 void Toolchain::SetTool(ToolType type, std::unique_ptr<Tool> t) {
95 DCHECK(type != TYPE_NONE); 95 DCHECK(type != TYPE_NONE);
96 DCHECK(!tools_[type].get()); 96 DCHECK(!tools_[type].get());
97 t->SetComplete(); 97 t->SetComplete();
98 tools_[type] = std::move(t); 98 tools_[type] = std::move(t);
99 } 99 }
100 100
101 void Toolchain::ToolchainSetupComplete() { 101 void Toolchain::ToolchainSetupComplete() {
102 // Collect required bits from all tools. 102 // Collect required bits from all tools.
103 for (const auto& tool : tools_) { 103 for (const auto& tool : tools_) {
104 if (tool) 104 if (tool)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return TYPE_STAMP; 165 return TYPE_STAMP;
166 default: 166 default:
167 NOTREACHED(); 167 NOTREACHED();
168 return Toolchain::TYPE_NONE; 168 return Toolchain::TYPE_NONE;
169 } 169 }
170 } 170 }
171 171
172 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const { 172 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const {
173 return tools_[GetToolTypeForTargetFinalOutput(target)].get(); 173 return tools_[GetToolTypeForTargetFinalOutput(target)].get();
174 } 174 }
OLDNEW
« no previous file with comments | « tools/gn/toolchain.h ('k') | tools/gn/value.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698