OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TOOLS_GN_IMPORT_MANAGER_H_ |
| 6 #define TOOLS_GN_IMPORT_MANAGER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/synchronization/lock.h" |
| 11 |
| 12 class Err; |
| 13 class ParseNode; |
| 14 class Scope; |
| 15 class SourceFile; |
| 16 |
| 17 // Provides a cache of the results of importing scopes so the results can |
| 18 // be re-used rather than running the imported files multiple times. |
| 19 class ImportManager { |
| 20 public: |
| 21 ImportManager(); |
| 22 ~ImportManager(); |
| 23 |
| 24 // Does an import of the given file into the given scope. On error, sets the |
| 25 // error and returns false. |
| 26 bool DoImport(const SourceFile& file, |
| 27 const ParseNode* node_for_err, |
| 28 Scope* scope, |
| 29 Err* err); |
| 30 |
| 31 private: |
| 32 base::Lock lock_; |
| 33 |
| 34 // Owning pointers to the scopes. |
| 35 typedef std::map<SourceFile, const Scope*> ImportMap; |
| 36 ImportMap imports_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(ImportManager); |
| 39 }; |
| 40 |
| 41 #endif // TOOLS_GN_IMPORT_MANAGER_H_ |
OLD | NEW |