| 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_INPUT_FILE_MANAGER_H_ | 5 #ifndef TOOLS_GN_INPUT_FILE_MANAGER_H_ |
| 6 #define TOOLS_GN_INPUT_FILE_MANAGER_H_ | 6 #define TOOLS_GN_INPUT_FILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // code is responsible for populating these values and maintaining | 72 // code is responsible for populating these values and maintaining |
| 73 // threadsafety. This class' only job is to hold onto the memory and delete | 73 // threadsafety. This class' only job is to hold onto the memory and delete |
| 74 // it when the program exits. | 74 // it when the program exits. |
| 75 // | 75 // |
| 76 // This solves the problem that sometimes we need to execute something | 76 // This solves the problem that sometimes we need to execute something |
| 77 // dynamic and save the result, but the values all have references to the | 77 // dynamic and save the result, but the values all have references to the |
| 78 // nodes and file that created it. Either we need to reset the origin of | 78 // nodes and file that created it. Either we need to reset the origin of |
| 79 // the values and lose context for error reporting, or somehow keep the | 79 // the values and lose context for error reporting, or somehow keep the |
| 80 // associated parse nodes, tokens, and file data in memory. This function | 80 // associated parse nodes, tokens, and file data in memory. This function |
| 81 // allows the latter. | 81 // allows the latter. |
| 82 void AddDynamicInput(InputFile** file, | 82 void AddDynamicInput(const SourceFile& name, |
| 83 InputFile** file, |
| 83 std::vector<Token>** tokens, | 84 std::vector<Token>** tokens, |
| 84 scoped_ptr<ParseNode>** parse_root); | 85 scoped_ptr<ParseNode>** parse_root); |
| 85 | 86 |
| 86 // Does not count dynamic input. | 87 // Does not count dynamic input. |
| 87 int GetInputFileCount() const; | 88 int GetInputFileCount() const; |
| 88 | 89 |
| 89 // Fills the vector with all input files. | 90 // Fills the vector with all input files. |
| 90 void GetAllPhysicalInputFileNames(std::vector<base::FilePath>* result) const; | 91 void GetAllPhysicalInputFileNames(std::vector<base::FilePath>* result) const; |
| 91 | 92 |
| 92 private: | 93 private: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // | 146 // |
| 146 // See AddDynamicInput(). | 147 // See AddDynamicInput(). |
| 147 // | 148 // |
| 148 // Owning pointers. | 149 // Owning pointers. |
| 149 std::vector<InputFileData*> dynamic_inputs_; | 150 std::vector<InputFileData*> dynamic_inputs_; |
| 150 | 151 |
| 151 DISALLOW_COPY_AND_ASSIGN(InputFileManager); | 152 DISALLOW_COPY_AND_ASSIGN(InputFileManager); |
| 152 }; | 153 }; |
| 153 | 154 |
| 154 #endif // TOOLS_GN_INPUT_FILE_MANAGER_H_ | 155 #endif // TOOLS_GN_INPUT_FILE_MANAGER_H_ |
| OLD | NEW |