| 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 <set> | 8 #include <set> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "tools/gn/item.h" | 13 #include "tools/gn/item.h" |
| 13 #include "tools/gn/location.h" | 14 #include "tools/gn/location.h" |
| 14 | 15 |
| 15 class ParseNode; | 16 class ParseNode; |
| 16 | 17 |
| 17 // 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 |
| 18 // 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 static const char* GetNameForType(ItemType type); | 48 static const char* GetNameForType(ItemType type); |
| 48 | 49 |
| 49 // Returns true if the given item is of the given type. | 50 // Returns true if the given item is of the given type. |
| 50 static bool IsItemOfType(const Item* item, ItemType type); | 51 static bool IsItemOfType(const Item* item, ItemType type); |
| 51 | 52 |
| 52 // Returns the type enum for the given item. | 53 // Returns the type enum for the given item. |
| 53 static ItemType TypeOfItem(const Item* item); | 54 static ItemType TypeOfItem(const Item* item); |
| 54 | 55 |
| 55 Item* item() { return item_.get(); } | 56 Item* item() { return item_.get(); } |
| 56 const Item* item() const { return item_.get(); } | 57 const Item* item() const { return item_.get(); } |
| 57 void set_item(scoped_ptr<Item> item) { item_ = item.Pass(); } | 58 void set_item(scoped_ptr<Item> item) { item_ = std::move(item); } |
| 58 | 59 |
| 59 // Indicates from where this item was originally referenced from that caused | 60 // Indicates from where this item was originally referenced from that caused |
| 60 // 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 |
| 61 // before a reference, this will be the empty range. | 62 // before a reference, this will be the empty range. |
| 62 const ParseNode* originally_referenced_from() const { | 63 const ParseNode* originally_referenced_from() const { |
| 63 return originally_referenced_from_; | 64 return originally_referenced_from_; |
| 64 } | 65 } |
| 65 void set_originally_referenced_from(const ParseNode* pn) { | 66 void set_originally_referenced_from(const ParseNode* pn) { |
| 66 originally_referenced_from_ = pn; | 67 originally_referenced_from_ = pn; |
| 67 } | 68 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 bool resolved_; | 103 bool resolved_; |
| 103 | 104 |
| 104 BuilderRecordSet all_deps_; | 105 BuilderRecordSet all_deps_; |
| 105 BuilderRecordSet unresolved_deps_; | 106 BuilderRecordSet unresolved_deps_; |
| 106 BuilderRecordSet waiting_on_resolution_; | 107 BuilderRecordSet waiting_on_resolution_; |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(BuilderRecord); | 109 DISALLOW_COPY_AND_ASSIGN(BuilderRecord); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 #endif // TOOLS_GN_BUILDER_RECORD_H_ | 112 #endif // TOOLS_GN_BUILDER_RECORD_H_ |
| OLD | NEW |