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

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

Issue 51693002: GN: toolchain threading cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/input_conversion.cc ('k') | tools/gn/item.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_ITEM_H_ 5 #ifndef TOOLS_GN_ITEM_H_
6 #define TOOLS_GN_ITEM_H_ 6 #define TOOLS_GN_ITEM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "tools/gn/label.h" 10 #include "tools/gn/label.h"
11 11
12 class Config; 12 class Config;
13 class ItemNode; 13 class ItemNode;
14 class Settings;
14 class Target; 15 class Target;
15 class Toolchain; 16 class Toolchain;
16 17
17 // A named item (target, config, etc.) that participates in the dependency 18 // A named item (target, config, etc.) that participates in the dependency
18 // graph. 19 // graph.
19 class Item { 20 class Item {
20 public: 21 public:
21 Item(const Label& label); 22 Item(const Settings* settings, const Label& label);
22 virtual ~Item(); 23 virtual ~Item();
23 24
25 const Settings* settings() const { return settings_; }
26
24 // This is guaranteed to never change after construction so this can be 27 // This is guaranteed to never change after construction so this can be
25 // accessed from any thread with no locking once the item is constructed. 28 // accessed from any thread with no locking once the item is constructed.
26 const Label& label() const { return label_; } 29 const Label& label() const { return label_; }
27 30
28 // The Item and the ItemNode make a pair. This will be set when the ItemNode 31 // The Item and the ItemNode make a pair. This will be set when the ItemNode
29 // is constructed that owns this Item. The ItemNode should only be 32 // is constructed that owns this Item. The ItemNode should only be
30 // dereferenced with the ItemTree lock held. 33 // dereferenced with the ItemTree lock held.
31 ItemNode* item_node() { return item_node_; } 34 ItemNode* item_node() { return item_node_; }
32 const ItemNode* item_node() const { return item_node_; } 35 const ItemNode* item_node() const { return item_node_; }
33 void set_item_node(ItemNode* in) { item_node_ = in; } 36 void set_item_node(ItemNode* in) { item_node_ = in; }
34 37
35 // Manual RTTI. 38 // Manual RTTI.
36 virtual Config* AsConfig(); 39 virtual Config* AsConfig();
37 virtual const Config* AsConfig() const; 40 virtual const Config* AsConfig() const;
38 virtual Target* AsTarget(); 41 virtual Target* AsTarget();
39 virtual const Target* AsTarget() const; 42 virtual const Target* AsTarget() const;
40 virtual Toolchain* AsToolchain(); 43 virtual Toolchain* AsToolchain();
41 virtual const Toolchain* AsToolchain() const; 44 virtual const Toolchain* AsToolchain() const;
42 45
43 // Returns a name like "target" or "config" for the type of item this is, to 46 // Returns a name like "target" or "config" for the type of item this is, to
44 // be used in logging and error messages. 47 // be used in logging and error messages.
45 std::string GetItemTypeName() const; 48 std::string GetItemTypeName() const;
46 49
47 // Called when this item is resolved, meaning it and all of its dependents 50 // Called when this item is resolved, meaning it and all of its dependents
48 // have no unresolved deps. 51 // have no unresolved deps.
49 virtual void OnResolved() {} 52 virtual void OnResolved() {}
50 53
51 private: 54 private:
55 const Settings* settings_;
52 Label label_; 56 Label label_;
53 57
54 ItemNode* item_node_; 58 ItemNode* item_node_;
55 }; 59 };
56 60
57 #endif // TOOLS_GN_ITEM_H_ 61 #endif // TOOLS_GN_ITEM_H_
OLDNEW
« no previous file with comments | « tools/gn/input_conversion.cc ('k') | tools/gn/item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698