OLD | NEW |
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 #include <memory> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 ~ImportManager(); | 24 ~ImportManager(); |
25 | 25 |
26 // 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 |
27 // error and returns false. | 27 // error and returns false. |
28 bool DoImport(const SourceFile& file, | 28 bool DoImport(const SourceFile& file, |
29 const ParseNode* node_for_err, | 29 const ParseNode* node_for_err, |
30 Scope* scope, | 30 Scope* scope, |
31 Err* err); | 31 Err* err); |
32 | 32 |
33 private: | 33 private: |
34 base::Lock lock_; | 34 struct ImportInfo; |
| 35 |
| 36 // Protects access to imports_. Do not hold when actually executing imports. |
| 37 base::Lock imports_lock_; |
35 | 38 |
36 // Owning pointers to the scopes. | 39 // Owning pointers to the scopes. |
37 typedef std::map<SourceFile, std::unique_ptr<const Scope>> ImportMap; | 40 typedef std::map<SourceFile, std::unique_ptr<ImportInfo>> ImportMap; |
38 ImportMap imports_; | 41 ImportMap imports_; |
39 | 42 |
40 DISALLOW_COPY_AND_ASSIGN(ImportManager); | 43 DISALLOW_COPY_AND_ASSIGN(ImportManager); |
41 }; | 44 }; |
42 | 45 |
43 #endif // TOOLS_GN_IMPORT_MANAGER_H_ | 46 #endif // TOOLS_GN_IMPORT_MANAGER_H_ |
OLD | NEW |