| 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_RECORD_H_ | 5 #ifndef TOOLS_GN_BUILDER_RECORD_H_ | 
| 6 #define TOOLS_GN_BUILDER_RECORD_H_ | 6 #define TOOLS_GN_BUILDER_RECORD_H_ | 
| 7 | 7 | 
|  | 8 #include <memory> | 
| 8 #include <set> | 9 #include <set> | 
| 9 #include <utility> | 10 #include <utility> | 
| 10 | 11 | 
| 11 #include "base/macros.h" | 12 #include "base/macros.h" | 
| 12 #include "base/memory/scoped_ptr.h" |  | 
| 13 #include "tools/gn/item.h" | 13 #include "tools/gn/item.h" | 
| 14 #include "tools/gn/location.h" | 14 #include "tools/gn/location.h" | 
| 15 | 15 | 
| 16 class ParseNode; | 16 class ParseNode; | 
| 17 | 17 | 
| 18 // This class is used by the builder to manage the loading of the dependency | 18 // This class is used by the builder to manage the loading of the dependency | 
| 19 // tree. It holds a reference to an item and links to other records that the | 19 // tree. It holds a reference to an item and links to other records that the | 
| 20 // item depends on, both resolved ones, and unresolved ones. | 20 // item depends on, both resolved ones, and unresolved ones. | 
| 21 // | 21 // | 
| 22 // If a target depends on another one that hasn't been defined yet, we'll make | 22 // If a target depends on another one that hasn't been defined yet, we'll make | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 48   static const char* GetNameForType(ItemType type); | 48   static const char* GetNameForType(ItemType type); | 
| 49 | 49 | 
| 50   // Returns true if the given item is of the given type. | 50   // Returns true if the given item is of the given type. | 
| 51   static bool IsItemOfType(const Item* item, ItemType type); | 51   static bool IsItemOfType(const Item* item, ItemType type); | 
| 52 | 52 | 
| 53   // Returns the type enum for the given item. | 53   // Returns the type enum for the given item. | 
| 54   static ItemType TypeOfItem(const Item* item); | 54   static ItemType TypeOfItem(const Item* item); | 
| 55 | 55 | 
| 56   Item* item() { return item_.get(); } | 56   Item* item() { return item_.get(); } | 
| 57   const Item* item() const { return item_.get(); } | 57   const Item* item() const { return item_.get(); } | 
| 58   void set_item(scoped_ptr<Item> item) { item_ = std::move(item); } | 58   void set_item(std::unique_ptr<Item> item) { item_ = std::move(item); } | 
| 59 | 59 | 
| 60   // Indicates from where this item was originally referenced from that caused | 60   // Indicates from where this item was originally referenced from that caused | 
| 61   // it to be loaded. For targets for which we encountered the declaration | 61   // it to be loaded. For targets for which we encountered the declaration | 
| 62   // before a reference, this will be the empty range. | 62   // before a reference, this will be the empty range. | 
| 63   const ParseNode* originally_referenced_from() const { | 63   const ParseNode* originally_referenced_from() const { | 
| 64     return originally_referenced_from_; | 64     return originally_referenced_from_; | 
| 65   } | 65   } | 
| 66   void set_originally_referenced_from(const ParseNode* pn) { | 66   void set_originally_referenced_from(const ParseNode* pn) { | 
| 67     originally_referenced_from_ = pn; | 67     originally_referenced_from_ = pn; | 
| 68   } | 68   } | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 90   BuilderRecordSet& waiting_on_resolution() { return waiting_on_resolution_; } | 90   BuilderRecordSet& waiting_on_resolution() { return waiting_on_resolution_; } | 
| 91   const BuilderRecordSet& waiting_on_resolution() const { | 91   const BuilderRecordSet& waiting_on_resolution() const { | 
| 92     return waiting_on_resolution_; | 92     return waiting_on_resolution_; | 
| 93   } | 93   } | 
| 94 | 94 | 
| 95   void AddDep(BuilderRecord* record); | 95   void AddDep(BuilderRecord* record); | 
| 96 | 96 | 
| 97  private: | 97  private: | 
| 98   ItemType type_; | 98   ItemType type_; | 
| 99   Label label_; | 99   Label label_; | 
| 100   scoped_ptr<Item> item_; | 100   std::unique_ptr<Item> item_; | 
| 101   const ParseNode* originally_referenced_from_; | 101   const ParseNode* originally_referenced_from_; | 
| 102   bool should_generate_; | 102   bool should_generate_; | 
| 103   bool resolved_; | 103   bool resolved_; | 
| 104 | 104 | 
| 105   BuilderRecordSet all_deps_; | 105   BuilderRecordSet all_deps_; | 
| 106   BuilderRecordSet unresolved_deps_; | 106   BuilderRecordSet unresolved_deps_; | 
| 107   BuilderRecordSet waiting_on_resolution_; | 107   BuilderRecordSet waiting_on_resolution_; | 
| 108 | 108 | 
| 109   DISALLOW_COPY_AND_ASSIGN(BuilderRecord); | 109   DISALLOW_COPY_AND_ASSIGN(BuilderRecord); | 
| 110 }; | 110 }; | 
| 111 | 111 | 
| 112 #endif  // TOOLS_GN_BUILDER_RECORD_H_ | 112 #endif  // TOOLS_GN_BUILDER_RECORD_H_ | 
| OLD | NEW | 
|---|