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

Side by Side Diff: tools/gn/builder_record.h

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « tools/gn/builder.cc ('k') | tools/gn/builder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « tools/gn/builder.cc ('k') | tools/gn/builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698