| 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_BUILDER_H_ |    5 #ifndef TOOLS_GN_BUILDER_H_ | 
|    6 #define TOOLS_GN_BUILDER_H_ |    6 #define TOOLS_GN_BUILDER_H_ | 
|    7  |    7  | 
|    8 #include "base/callback.h" |    8 #include "base/callback.h" | 
|    9 #include "base/containers/hash_tables.h" |    9 #include "base/containers/hash_tables.h" | 
|   10 #include "base/macros.h" |   10 #include "base/macros.h" | 
|   11 #include "tools/gn/builder_record.h" |   11 #include "tools/gn/builder_record.h" | 
|   12 #include "tools/gn/label.h" |   12 #include "tools/gn/label.h" | 
|   13 #include "tools/gn/label_ptr.h" |   13 #include "tools/gn/label_ptr.h" | 
|   14 #include "tools/gn/unique_vector.h" |   14 #include "tools/gn/unique_vector.h" | 
|   15  |   15  | 
|   16 class Config; |   16 class Config; | 
|   17 class Err; |   17 class Err; | 
|   18 class Loader; |   18 class Loader; | 
|   19 class ParseNode; |   19 class ParseNode; | 
|   20  |   20  | 
|   21 // The builder assembles the dependency tree. It is not threadsafe and runs on |   21 // The builder assembles the dependency tree. It is not threadsafe and runs on | 
|   22 // the main thread only. See also BuilderRecord. |   22 // the main thread only. See also BuilderRecord. | 
|   23 class Builder { |   23 class Builder { | 
|   24  public: |   24  public: | 
|   25   typedef base::Callback<void(const BuilderRecord*)> ResolvedCallback; |   25   typedef base::Callback<void(const BuilderRecord*)> ResolvedGeneratedCallback; | 
|   26  |   26  | 
|   27   explicit Builder(Loader* loader); |   27   explicit Builder(Loader* loader); | 
|   28   ~Builder(); |   28   ~Builder(); | 
|   29  |   29  | 
|   30   // The resolved callback is called whenever a target has been resolved. This |   30   // The resolved callback is called when a target has been both resolved and | 
|   31   // will be executed only on the main thread. |   31   // marked generated. This will be executed only on the main thread. | 
|   32   void set_resolved_callback(const ResolvedCallback& cb) { |   32   void set_resolved_and_generated_callback( | 
|   33     resolved_callback_ = cb; |   33       const ResolvedGeneratedCallback& cb) { | 
 |   34     resolved_and_generated_callback_ = cb; | 
|   34   } |   35   } | 
|   35  |   36  | 
|   36   Loader* loader() const { return loader_; } |   37   Loader* loader() const { return loader_; } | 
|   37  |   38  | 
|   38   void ItemDefined(std::unique_ptr<Item> item); |   39   void ItemDefined(std::unique_ptr<Item> item); | 
|   39  |   40  | 
|   40   // Returns NULL if there is not a thing with the corresponding label. |   41   // Returns NULL if there is not a thing with the corresponding label. | 
|   41   const Item* GetItem(const Label& label) const; |   42   const Item* GetItem(const Label& label) const; | 
|   42   const Toolchain* GetToolchain(const Label& label) const; |   43   const Toolchain* GetToolchain(const Label& label) const; | 
|   43  |   44  | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  125   std::string CheckForCircularDependencies( |  126   std::string CheckForCircularDependencies( | 
|  126       const std::vector<const BuilderRecord*>& bad_records) const; |  127       const std::vector<const BuilderRecord*>& bad_records) const; | 
|  127  |  128  | 
|  128   // Non owning pointer. |  129   // Non owning pointer. | 
|  129   Loader* loader_; |  130   Loader* loader_; | 
|  130  |  131  | 
|  131   // Owning pointers. |  132   // Owning pointers. | 
|  132   typedef base::hash_map<Label, BuilderRecord*> RecordMap; |  133   typedef base::hash_map<Label, BuilderRecord*> RecordMap; | 
|  133   RecordMap records_; |  134   RecordMap records_; | 
|  134  |  135  | 
|  135   ResolvedCallback resolved_callback_; |  136   ResolvedGeneratedCallback resolved_and_generated_callback_; | 
|  136  |  137  | 
|  137   DISALLOW_COPY_AND_ASSIGN(Builder); |  138   DISALLOW_COPY_AND_ASSIGN(Builder); | 
|  138 }; |  139 }; | 
|  139  |  140  | 
|  140 #endif  // TOOLS_GN_BUILDER_H_ |  141 #endif  // TOOLS_GN_BUILDER_H_ | 
| OLD | NEW |