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

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

Issue 2972113002: Remove ScopedVector from tools/gn/. (Closed)
Patch Set: Created 3 years, 5 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/loader.cc ('k') | tools/gn/target_generator.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 #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 <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <utility> 11 #include <utility>
12 #include <vector>
12 13
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_vector.h"
17 #include "tools/gn/err.h" 17 #include "tools/gn/err.h"
18 #include "tools/gn/input_file.h" 18 #include "tools/gn/input_file.h"
19 #include "tools/gn/pattern.h" 19 #include "tools/gn/pattern.h"
20 #include "tools/gn/source_dir.h" 20 #include "tools/gn/source_dir.h"
21 #include "tools/gn/value.h" 21 #include "tools/gn/value.h"
22 22
23 class Item; 23 class Item;
24 class ParseNode; 24 class ParseNode;
25 class Settings; 25 class Settings;
26 class Template; 26 class Template;
27 27
28 // Scope for the script execution. 28 // Scope for the script execution.
29 // 29 //
30 // Scopes are nested. Writing goes into the toplevel scope, reading checks 30 // Scopes are nested. Writing goes into the toplevel scope, reading checks
31 // values resursively down the stack until a match is found or there are no 31 // values resursively down the stack until a match is found or there are no
32 // more containing scopes. 32 // more containing scopes.
33 // 33 //
34 // A containing scope can be const or non-const. The const containing scope is 34 // A containing scope can be const or non-const. The const containing scope is
35 // used primarily to refer to the master build config which is shared across 35 // used primarily to refer to the master build config which is shared across
36 // many invocations. A const containing scope, however, prevents us from 36 // many invocations. A const containing scope, however, prevents us from
37 // marking variables "used" which prevents us from issuing errors on unused 37 // marking variables "used" which prevents us from issuing errors on unused
38 // variables. So you should use a non-const containing scope whenever possible. 38 // variables. So you should use a non-const containing scope whenever possible.
39 class Scope { 39 class Scope {
40 public: 40 public:
41 typedef base::hash_map<base::StringPiece, Value, base::StringPieceHash> 41 typedef base::hash_map<base::StringPiece, Value, base::StringPieceHash>
42 KeyValueMap; 42 KeyValueMap;
43 // Holds an owning list of Items. 43 // Holds an owning list of Items.
44 typedef ScopedVector<Item> ItemVector; 44 typedef std::vector<std::unique_ptr<Item>> ItemVector;
45 45
46 // A flag to indicate whether a function should recurse into nested scopes, 46 // A flag to indicate whether a function should recurse into nested scopes,
47 // or only operate on the current scope. 47 // or only operate on the current scope.
48 enum SearchNested { 48 enum SearchNested {
49 SEARCH_NESTED, 49 SEARCH_NESTED,
50 SEARCH_CURRENT 50 SEARCH_CURRENT
51 }; 51 };
52 52
53 // Allows code to provide values for built-in variables. This class will 53 // Allows code to provide values for built-in variables. This class will
54 // automatically register itself on construction and deregister itself on 54 // automatically register itself on construction and deregister itself on
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 ProviderSet programmatic_providers_; 383 ProviderSet programmatic_providers_;
384 384
385 SourceDir source_dir_; 385 SourceDir source_dir_;
386 386
387 InputFileSet input_files_; 387 InputFileSet input_files_;
388 388
389 DISALLOW_COPY_AND_ASSIGN(Scope); 389 DISALLOW_COPY_AND_ASSIGN(Scope);
390 }; 390 };
391 391
392 #endif // TOOLS_GN_SCOPE_H_ 392 #endif // TOOLS_GN_SCOPE_H_
OLDNEW
« no previous file with comments | « 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