Add a missing dependency to //extensions/extensions_renderer_resources
[chromium-blink-merge.git] / tools / gn / import_manager.h
blob725a5b28a0bbd4f701521d2239af1ff63fff3811
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.
5 #ifndef TOOLS_GN_IMPORT_MANAGER_H_
6 #define TOOLS_GN_IMPORT_MANAGER_H_
8 #include <map>
10 #include "base/synchronization/lock.h"
12 class Err;
13 class ParseNode;
14 class Scope;
15 class SourceFile;
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();
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);
31 private:
32 base::Lock lock_;
34 // Owning pointers to the scopes.
35 typedef std::map<SourceFile, const Scope*> ImportMap;
36 ImportMap imports_;
38 DISALLOW_COPY_AND_ASSIGN(ImportManager);
41 #endif // TOOLS_GN_IMPORT_MANAGER_H_