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

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

Issue 56433003: GN threading refactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/scope.cc ('k') | tools/gn/script_target_generator.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/scope_per_file_provider.h" 5 #include "tools/gn/scope_per_file_provider.h"
6 6
7 #include "tools/gn/filesystem_utils.h" 7 #include "tools/gn/filesystem_utils.h"
8 #include "tools/gn/settings.h" 8 #include "tools/gn/settings.h"
9 #include "tools/gn/source_file.h" 9 #include "tools/gn/source_file.h"
10 #include "tools/gn/toolchain_manager.h"
11 #include "tools/gn/value.h" 10 #include "tools/gn/value.h"
12 #include "tools/gn/variables.h" 11 #include "tools/gn/variables.h"
13 12
14 ScopePerFileProvider::ScopePerFileProvider(Scope* scope) 13 ScopePerFileProvider::ScopePerFileProvider(Scope* scope)
15 : ProgrammaticProvider(scope) { 14 : ProgrammaticProvider(scope) {
16 } 15 }
17 16
18 ScopePerFileProvider::~ScopePerFileProvider() { 17 ScopePerFileProvider::~ScopePerFileProvider() {
19 } 18 }
20 19
(...skipping 22 matching lines...) Expand all
43 const Value* ScopePerFileProvider::GetCurrentToolchain() { 42 const Value* ScopePerFileProvider::GetCurrentToolchain() {
44 if (!current_toolchain_) { 43 if (!current_toolchain_) {
45 current_toolchain_.reset(new Value(NULL, 44 current_toolchain_.reset(new Value(NULL,
46 scope_->settings()->toolchain_label().GetUserVisibleName(false))); 45 scope_->settings()->toolchain_label().GetUserVisibleName(false)));
47 } 46 }
48 return current_toolchain_.get(); 47 return current_toolchain_.get();
49 } 48 }
50 49
51 const Value* ScopePerFileProvider::GetDefaultToolchain() { 50 const Value* ScopePerFileProvider::GetDefaultToolchain() {
52 if (!default_toolchain_) { 51 if (!default_toolchain_) {
53 const ToolchainManager& toolchain_manager =
54 scope_->settings()->build_settings()->toolchain_manager();
55 default_toolchain_.reset(new Value(NULL, 52 default_toolchain_.reset(new Value(NULL,
56 toolchain_manager.GetDefaultToolchainUnlocked().GetUserVisibleName( 53 scope_->settings()->default_toolchain_label().GetUserVisibleName(
57 false))); 54 false)));
58 } 55 }
59 return default_toolchain_.get(); 56 return default_toolchain_.get();
60 } 57 }
61 58
62 const Value* ScopePerFileProvider::GetPythonPath() { 59 const Value* ScopePerFileProvider::GetPythonPath() {
63 if (!python_path_) { 60 if (!python_path_) {
64 python_path_.reset(new Value(NULL, 61 python_path_.reset(new Value(NULL,
65 FilePathToUTF8(scope_->settings()->build_settings()->python_path()))); 62 FilePathToUTF8(scope_->settings()->build_settings()->python_path())));
66 } 63 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 const std::string& dir_value = scope_->GetSourceDir().value(); 152 const std::string& dir_value = scope_->GetSourceDir().value();
156 153
157 if (dir_value == "//") 154 if (dir_value == "//")
158 return "//."; 155 return "//.";
159 156
160 // Trim off a leading and trailing slash. So "//foo/bar/" -> /foo/bar". 157 // Trim off a leading and trailing slash. So "//foo/bar/" -> /foo/bar".
161 DCHECK(dir_value.size() > 2 && dir_value[0] == '/' && 158 DCHECK(dir_value.size() > 2 && dir_value[0] == '/' &&
162 dir_value[dir_value.size() - 1] == '/'); 159 dir_value[dir_value.size() - 1] == '/');
163 return dir_value.substr(1, dir_value.size() - 2); 160 return dir_value.substr(1, dir_value.size() - 2);
164 } 161 }
OLDNEW
« no previous file with comments | « tools/gn/scope.cc ('k') | tools/gn/script_target_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698