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

Unified Diff: tools/gn/input_file_manager.h

Issue 223783005: Add support for reading .gypi files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/input_conversion_unittest.cc ('k') | tools/gn/input_file_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/input_file_manager.h
diff --git a/tools/gn/input_file_manager.h b/tools/gn/input_file_manager.h
index ae6533a6bf7b3ab6e4071face0e306002053284b..5c5b5b00a45909dca33618834bf23bb8fc771c38 100644
--- a/tools/gn/input_file_manager.h
+++ b/tools/gn/input_file_manager.h
@@ -64,6 +64,26 @@ class InputFileManager : public base::RefCountedThreadSafe<InputFileManager> {
const SourceFile& file_name,
Err* err);
+ // Creates an entry to manage the memory associated with keeping a parsed
+ // set of code in memory.
+ //
+ // The values pointed to by the parameters will be filled with pointers to
+ // the file, tokens, and parse node that this class created. The calling
+ // code is responsible for populating these values and maintaining
+ // threadsafety. This class' only job is to hold onto the memory and delete
+ // it when the program exits.
+ //
+ // This solves the problem that sometimes we need to execute something
+ // dynamic and save the result, but the values all have references to the
+ // nodes and file that created it. Either we need to reset the origin of
+ // the values and lose context for error reporting, or somehow keep the
+ // associated parse nodes, tokens, and file data in memory. This function
+ // allows the latter.
+ void AddDynamicInput(InputFile** file,
+ std::vector<Token>** tokens,
+ scoped_ptr<ParseNode>** parse_root);
+
+ // Does not count dynamic input.
int GetInputFileCount() const;
// Fills the vector with all input files.
@@ -118,6 +138,16 @@ class InputFileManager : public base::RefCountedThreadSafe<InputFileManager> {
typedef base::hash_map<SourceFile, InputFileData*> InputFileMap;
InputFileMap input_files_;
+ // Tracks all dynamic inputs. The data are holders for memory management
+ // purposes and should not be read or modified by this class. The values
+ // will be vended out to the code creating the dynamic input, who is in
+ // charge of the threadsafety requirements.
+ //
+ // See AddDynamicInput().
+ //
+ // Owning pointers.
+ std::vector<InputFileData*> dynamic_inputs_;
+
DISALLOW_COPY_AND_ASSIGN(InputFileManager);
};
« no previous file with comments | « tools/gn/input_conversion_unittest.cc ('k') | tools/gn/input_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698