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

Side by Side Diff: tools/gn/scope.h

Issue 654263004: Simplify ScopedVector<scoped_ptr<T>> to ScopedVector<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 #ifndef TOOLS_GN_SCOPE_H_ 5 #ifndef TOOLS_GN_SCOPE_H_
6 #define TOOLS_GN_SCOPE_H_ 6 #define TOOLS_GN_SCOPE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 22 matching lines...) Expand all
33 // more containing scopes. 33 // more containing scopes.
34 // 34 //
35 // A containing scope can be const or non-const. The const containing scope is 35 // A containing scope can be const or non-const. The const containing scope is
36 // used primarily to refer to the master build config which is shared across 36 // used primarily to refer to the master build config which is shared across
37 // many invocations. A const containing scope, however, prevents us from 37 // many invocations. A const containing scope, however, prevents us from
38 // marking variables "used" which prevents us from issuing errors on unused 38 // marking variables "used" which prevents us from issuing errors on unused
39 // variables. So you should use a non-const containing scope whenever possible. 39 // variables. So you should use a non-const containing scope whenever possible.
40 class Scope { 40 class Scope {
41 public: 41 public:
42 typedef base::hash_map<base::StringPiece, Value> KeyValueMap; 42 typedef base::hash_map<base::StringPiece, Value> KeyValueMap;
43 // Holds an owning list of scoped_ptrs of Items (since we can't make a vector 43 // Holds an owning list of Items.
44 // of scoped_ptrs). 44 typedef ScopedVector<Item> ItemVector;
45 typedef ScopedVector< scoped_ptr<Item> > ItemVector;
46 45
47 // Allows code to provide values for built-in variables. This class will 46 // Allows code to provide values for built-in variables. This class will
48 // automatically register itself on construction and deregister itself on 47 // automatically register itself on construction and deregister itself on
49 // destruction. 48 // destruction.
50 class ProgrammaticProvider { 49 class ProgrammaticProvider {
51 public: 50 public:
52 ProgrammaticProvider(Scope* scope) : scope_(scope) { 51 ProgrammaticProvider(Scope* scope) : scope_(scope) {
53 scope_->AddProvider(this); 52 scope_->AddProvider(this);
54 } 53 }
55 ~ProgrammaticProvider() { 54 ~ProgrammaticProvider() {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 347
349 typedef std::set<ProgrammaticProvider*> ProviderSet; 348 typedef std::set<ProgrammaticProvider*> ProviderSet;
350 ProviderSet programmatic_providers_; 349 ProviderSet programmatic_providers_;
351 350
352 SourceDir source_dir_; 351 SourceDir source_dir_;
353 352
354 DISALLOW_COPY_AND_ASSIGN(Scope); 353 DISALLOW_COPY_AND_ASSIGN(Scope);
355 }; 354 };
356 355
357 #endif // TOOLS_GN_SCOPE_H_ 356 #endif // TOOLS_GN_SCOPE_H_
OLDNEW
« tools/gn/loader.cc ('K') | « tools/gn/loader.cc ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698