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

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

Issue 1886453002: GN: Use std::unique_ptr for owned pointers in ImportManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | tools/gn/import_manager.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_IMPORT_MANAGER_H_ 5 #ifndef TOOLS_GN_IMPORT_MANAGER_H_
6 #define TOOLS_GN_IMPORT_MANAGER_H_ 6 #define TOOLS_GN_IMPORT_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 13
13 class Err; 14 class Err;
14 class ParseNode; 15 class ParseNode;
15 class Scope; 16 class Scope;
16 class SourceFile; 17 class SourceFile;
17 18
18 // Provides a cache of the results of importing scopes so the results can 19 // Provides a cache of the results of importing scopes so the results can
19 // be re-used rather than running the imported files multiple times. 20 // be re-used rather than running the imported files multiple times.
20 class ImportManager { 21 class ImportManager {
21 public: 22 public:
22 ImportManager(); 23 ImportManager();
23 ~ImportManager(); 24 ~ImportManager();
24 25
25 // Does an import of the given file into the given scope. On error, sets the 26 // Does an import of the given file into the given scope. On error, sets the
26 // error and returns false. 27 // error and returns false.
27 bool DoImport(const SourceFile& file, 28 bool DoImport(const SourceFile& file,
28 const ParseNode* node_for_err, 29 const ParseNode* node_for_err,
29 Scope* scope, 30 Scope* scope,
30 Err* err); 31 Err* err);
31 32
32 private: 33 private:
33 base::Lock lock_; 34 base::Lock lock_;
34 35
35 // Owning pointers to the scopes. 36 // Owning pointers to the scopes.
36 typedef std::map<SourceFile, const Scope*> ImportMap; 37 typedef std::map<SourceFile, std::unique_ptr<const Scope>> ImportMap;
37 ImportMap imports_; 38 ImportMap imports_;
38 39
39 DISALLOW_COPY_AND_ASSIGN(ImportManager); 40 DISALLOW_COPY_AND_ASSIGN(ImportManager);
40 }; 41 };
41 42
42 #endif // TOOLS_GN_IMPORT_MANAGER_H_ 43 #endif // TOOLS_GN_IMPORT_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | tools/gn/import_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698