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

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

Issue 1883093002: Add support for generating the QtCreator projects from GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_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 #include <vector>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
13 14
14 class Err; 15 class Err;
15 class ParseNode; 16 class ParseNode;
16 class Scope; 17 class Scope;
17 class SourceFile; 18 class SourceFile;
18 19
19 // Provides a cache of the results of importing scopes so the results can 20 // Provides a cache of the results of importing scopes so the results can
20 // be re-used rather than running the imported files multiple times. 21 // be re-used rather than running the imported files multiple times.
21 class ImportManager { 22 class ImportManager {
22 public: 23 public:
23 ImportManager(); 24 ImportManager();
24 ~ImportManager(); 25 ~ImportManager();
25 26
26 // Does an import of the given file into the given scope. On error, sets the 27 // Does an import of the given file into the given scope. On error, sets the
27 // error and returns false. 28 // error and returns false.
28 bool DoImport(const SourceFile& file, 29 bool DoImport(const SourceFile& file,
29 const ParseNode* node_for_err, 30 const ParseNode* node_for_err,
30 Scope* scope, 31 Scope* scope,
31 Err* err); 32 Err* err);
32 33
34 std::vector<SourceFile> GetImportedFiles() const;
35
33 private: 36 private:
34 struct ImportInfo; 37 struct ImportInfo;
35 38
36 // Protects access to imports_. Do not hold when actually executing imports. 39 // Protects access to imports_. Do not hold when actually executing imports.
37 base::Lock imports_lock_; 40 base::Lock imports_lock_;
38 41
39 // Owning pointers to the scopes. 42 // Owning pointers to the scopes.
40 typedef std::map<SourceFile, std::unique_ptr<ImportInfo>> ImportMap; 43 typedef std::map<SourceFile, std::unique_ptr<ImportInfo>> ImportMap;
41 ImportMap imports_; 44 ImportMap imports_;
42 45
43 DISALLOW_COPY_AND_ASSIGN(ImportManager); 46 DISALLOW_COPY_AND_ASSIGN(ImportManager);
44 }; 47 };
45 48
46 #endif // TOOLS_GN_IMPORT_MANAGER_H_ 49 #endif // TOOLS_GN_IMPORT_MANAGER_H_
OLDNEW
« tools/gn/command_gen.cc ('K') | « tools/gn/gn.gyp ('k') | tools/gn/import_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698