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

Side by Side Diff: tools/gn/function_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/exec_process.cc ('k') | tools/gn/functions.cc » ('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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 #include <utility> 7 #include <utility>
8 8
9 #include "tools/gn/err.h" 9 #include "tools/gn/err.h"
10 #include "tools/gn/functions.h" 10 #include "tools/gn/functions.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Note that we don't want to use MakeLabelForScope since that will include 317 // Note that we don't want to use MakeLabelForScope since that will include
318 // the toolchain name in the label, and toolchain labels don't themselves 318 // the toolchain name in the label, and toolchain labels don't themselves
319 // have toolchain names. 319 // have toolchain names.
320 const SourceDir& input_dir = scope->GetSourceDir(); 320 const SourceDir& input_dir = scope->GetSourceDir();
321 Label label(input_dir, args[0].string_value()); 321 Label label(input_dir, args[0].string_value());
322 if (g_scheduler->verbose_logging()) 322 if (g_scheduler->verbose_logging())
323 g_scheduler->Log("Defining toolchain", label.GetUserVisibleName(false)); 323 g_scheduler->Log("Defining toolchain", label.GetUserVisibleName(false));
324 324
325 // This object will actually be copied into the one owned by the toolchain 325 // This object will actually be copied into the one owned by the toolchain
326 // manager, but that has to be done in the lock. 326 // manager, but that has to be done in the lock.
327 scoped_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label)); 327 std::unique_ptr<Toolchain> toolchain(new Toolchain(scope->settings(), label));
328 toolchain->set_defined_from(function); 328 toolchain->set_defined_from(function);
329 toolchain->visibility().SetPublic(); 329 toolchain->visibility().SetPublic();
330 330
331 Scope block_scope(scope); 331 Scope block_scope(scope);
332 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get()); 332 block_scope.SetProperty(&kToolchainPropertyKey, toolchain.get());
333 block->Execute(&block_scope, err); 333 block->Execute(&block_scope, err);
334 block_scope.SetProperty(&kToolchainPropertyKey, nullptr); 334 block_scope.SetProperty(&kToolchainPropertyKey, nullptr);
335 if (err->has_error()) 335 if (err->has_error())
336 return Value(); 336 return Value();
337 337
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 subst_validator = &IsValidCopySubstitution; 837 subst_validator = &IsValidCopySubstitution;
838 subst_output_validator = &IsValidCopySubstitution; 838 subst_output_validator = &IsValidCopySubstitution;
839 } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) { 839 } else if (tool_type == Toolchain::TYPE_COMPILE_XCASSETS) {
840 subst_validator = &IsValidCompileXCassetsSubstitution; 840 subst_validator = &IsValidCompileXCassetsSubstitution;
841 subst_output_validator = &IsValidCompileXCassetsSubstitution; 841 subst_output_validator = &IsValidCompileXCassetsSubstitution;
842 } else { 842 } else {
843 subst_validator = &IsValidToolSubstitution; 843 subst_validator = &IsValidToolSubstitution;
844 subst_output_validator = &IsValidToolSubstitution; 844 subst_output_validator = &IsValidToolSubstitution;
845 } 845 }
846 846
847 scoped_ptr<Tool> tool(new Tool); 847 std::unique_ptr<Tool> tool(new Tool);
848 848
849 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(), 849 if (!ReadPattern(&block_scope, "command", subst_validator, tool.get(),
850 &Tool::set_command, err) || 850 &Tool::set_command, err) ||
851 !ReadOutputExtension(&block_scope, tool.get(), err) || 851 !ReadOutputExtension(&block_scope, tool.get(), err) ||
852 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(), 852 !ReadPattern(&block_scope, "depfile", subst_validator, tool.get(),
853 &Tool::set_depfile, err) || 853 &Tool::set_depfile, err) ||
854 !ReadDepsFormat(&block_scope, tool.get(), err) || 854 !ReadDepsFormat(&block_scope, tool.get(), err) ||
855 !ReadPattern(&block_scope, "description", subst_validator, tool.get(), 855 !ReadPattern(&block_scope, "description", subst_validator, tool.get(),
856 &Tool::set_description, err) || 856 &Tool::set_description, err) ||
857 !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch, 857 !ReadString(&block_scope, "lib_switch", tool.get(), &Tool::set_lib_switch,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 return Value(); 1013 return Value();
1014 1014
1015 Scope::KeyValueMap values; 1015 Scope::KeyValueMap values;
1016 block_scope.GetCurrentScopeValues(&values); 1016 block_scope.GetCurrentScopeValues(&values);
1017 toolchain->args() = values; 1017 toolchain->args() = values;
1018 1018
1019 return Value(); 1019 return Value();
1020 } 1020 }
1021 1021
1022 } // namespace functions 1022 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/exec_process.cc ('k') | tools/gn/functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698