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_ITEM_H_ | 5 #ifndef TOOLS_GN_ITEM_H_ |
6 #define TOOLS_GN_ITEM_H_ | 6 #define TOOLS_GN_ITEM_H_ |
7 | 7 |
| 8 #include <set> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "tools/gn/label.h" | 11 #include "tools/gn/label.h" |
| 12 #include "tools/gn/source_file.h" |
11 #include "tools/gn/visibility.h" | 13 #include "tools/gn/visibility.h" |
12 | 14 |
13 class Config; | 15 class Config; |
14 class ParseNode; | 16 class ParseNode; |
15 class Pool; | 17 class Pool; |
16 class Settings; | 18 class Settings; |
17 class Target; | 19 class Target; |
18 class Toolchain; | 20 class Toolchain; |
19 | 21 |
20 // A named item (target, config, etc.) that participates in the dependency | 22 // A named item (target, config, etc.) that participates in the dependency |
21 // graph. | 23 // graph. |
22 class Item { | 24 class Item { |
23 public: | 25 public: |
24 Item(const Settings* settings, const Label& label); | 26 Item(const Settings* settings, |
| 27 const Label& label, |
| 28 const std::set<uint32_t>& source_files_hashes); |
25 virtual ~Item(); | 29 virtual ~Item(); |
26 | 30 |
27 const Settings* settings() const { return settings_; } | 31 const Settings* settings() const { return settings_; } |
28 | 32 |
29 // This is guaranteed to never change after construction so this can be | 33 // This is guaranteed to never change after construction so this can be |
30 // accessed from any thread with no locking once the item is constructed. | 34 // accessed from any thread with no locking once the item is constructed. |
31 const Label& label() const { return label_; } | 35 const Label& label() const { return label_; } |
32 | 36 |
33 const ParseNode* defined_from() const { return defined_from_; } | 37 const ParseNode* defined_from() const { return defined_from_; } |
34 void set_defined_from(const ParseNode* df) { defined_from_ = df; } | 38 void set_defined_from(const ParseNode* df) { defined_from_ = df; } |
(...skipping 13 matching lines...) Expand all Loading... |
48 | 52 |
49 // Returns a name like "target" or "config" for the type of item this is, to | 53 // Returns a name like "target" or "config" for the type of item this is, to |
50 // be used in logging and error messages. | 54 // be used in logging and error messages. |
51 std::string GetItemTypeName() const; | 55 std::string GetItemTypeName() const; |
52 | 56 |
53 // Called when this item is resolved, meaning it and all of its dependents | 57 // Called when this item is resolved, meaning it and all of its dependents |
54 // have no unresolved deps. Returns true on success. Sets the error and | 58 // have no unresolved deps. Returns true on success. Sets the error and |
55 // returns false on failure. | 59 // returns false on failure. |
56 virtual bool OnResolved(Err* err); | 60 virtual bool OnResolved(Err* err); |
57 | 61 |
| 62 const std::set<uint32_t>& source_files_hashes() const { |
| 63 return source_files_hashes_; |
| 64 } |
| 65 |
58 private: | 66 private: |
59 const Settings* settings_; | 67 const Settings* settings_; |
60 Label label_; | 68 Label label_; |
61 const ParseNode* defined_from_; | 69 const ParseNode* defined_from_; |
62 | 70 |
63 Visibility visibility_; | 71 Visibility visibility_; |
| 72 std::set<uint32_t> source_files_hashes_; |
64 }; | 73 }; |
65 | 74 |
66 #endif // TOOLS_GN_ITEM_H_ | 75 #endif // TOOLS_GN_ITEM_H_ |
OLD | NEW |