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

Side by Side Diff: tools/gn/scope.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.h ('k') | tools/gn/scope_per_file_provider.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 "tools/gn/scope.h" 5 #include "tools/gn/scope.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 10
11 namespace { 11 namespace {
12 12
13 // FLags set in the mode_flags_ of a scope. If a bit is set, it applies 13 // FLags set in the mode_flags_ of a scope. If a bit is set, it applies
14 // recursively to all dependent scopes. 14 // recursively to all dependent scopes.
15 const unsigned kProcessingBuildConfigFlag = 1; 15 const unsigned kProcessingBuildConfigFlag = 1;
16 const unsigned kProcessingDefaultBuildConfigFlag = 2; 16 const unsigned kProcessingImportFlag = 2;
17 const unsigned kProcessingImportFlag = 4;
18 17
19 } // namespace 18 } // namespace
20 19
21 Scope::Scope(const Settings* settings) 20 Scope::Scope(const Settings* settings)
22 : const_containing_(NULL), 21 : const_containing_(NULL),
23 mutable_containing_(NULL), 22 mutable_containing_(NULL),
24 settings_(settings), 23 settings_(settings),
25 mode_flags_(0) { 24 mode_flags_(0) {
26 } 25 }
27 26
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 295 }
297 296
298 bool Scope::IsProcessingBuildConfig() const { 297 bool Scope::IsProcessingBuildConfig() const {
299 if (mode_flags_ & kProcessingBuildConfigFlag) 298 if (mode_flags_ & kProcessingBuildConfigFlag)
300 return true; 299 return true;
301 if (containing()) 300 if (containing())
302 return containing()->IsProcessingBuildConfig(); 301 return containing()->IsProcessingBuildConfig();
303 return false; 302 return false;
304 } 303 }
305 304
306 void Scope::SetProcessingDefaultBuildConfig() {
307 DCHECK((mode_flags_ & kProcessingDefaultBuildConfigFlag) == 0);
308 mode_flags_ |= kProcessingDefaultBuildConfigFlag;
309 }
310
311 void Scope::ClearProcessingDefaultBuildConfig() {
312 DCHECK(mode_flags_ & kProcessingDefaultBuildConfigFlag);
313 mode_flags_ &= ~(kProcessingDefaultBuildConfigFlag);
314 }
315
316 bool Scope::IsProcessingDefaultBuildConfig() const {
317 if (mode_flags_ & kProcessingDefaultBuildConfigFlag)
318 return true;
319 if (containing())
320 return containing()->IsProcessingDefaultBuildConfig();
321 return false;
322 }
323
324 void Scope::SetProcessingImport() { 305 void Scope::SetProcessingImport() {
325 DCHECK((mode_flags_ & kProcessingImportFlag) == 0); 306 DCHECK((mode_flags_ & kProcessingImportFlag) == 0);
326 mode_flags_ |= kProcessingImportFlag; 307 mode_flags_ |= kProcessingImportFlag;
327 } 308 }
328 309
329 void Scope::ClearProcessingImport() { 310 void Scope::ClearProcessingImport() {
330 DCHECK(mode_flags_ & kProcessingImportFlag); 311 DCHECK(mode_flags_ & kProcessingImportFlag);
331 mode_flags_ &= ~(kProcessingImportFlag); 312 mode_flags_ &= ~(kProcessingImportFlag);
332 } 313 }
333 314
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 350 }
370 351
371 void Scope::AddProvider(ProgrammaticProvider* p) { 352 void Scope::AddProvider(ProgrammaticProvider* p) {
372 programmatic_providers_.insert(p); 353 programmatic_providers_.insert(p);
373 } 354 }
374 355
375 void Scope::RemoveProvider(ProgrammaticProvider* p) { 356 void Scope::RemoveProvider(ProgrammaticProvider* p) {
376 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end()); 357 DCHECK(programmatic_providers_.find(p) != programmatic_providers_.end());
377 programmatic_providers_.erase(p); 358 programmatic_providers_.erase(p);
378 } 359 }
OLDNEW
« no previous file with comments | « tools/gn/scope.h ('k') | tools/gn/scope_per_file_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698