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_H_ | 5 #ifndef TOOLS_GN_BUILDER_H_ |
6 #define TOOLS_GN_BUILDER_H_ | 6 #define TOOLS_GN_BUILDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "tools/gn/builder_record.h" | 12 #include "tools/gn/builder_record.h" |
13 #include "tools/gn/label.h" | 13 #include "tools/gn/label.h" |
14 #include "tools/gn/label_ptr.h" | 14 #include "tools/gn/label_ptr.h" |
15 #include "tools/gn/unique_vector.h" | 15 #include "tools/gn/unique_vector.h" |
16 | 16 |
17 class Config; | 17 class Config; |
18 class Err; | 18 class Err; |
19 class Loader; | 19 class Loader; |
20 class ParseNode; | 20 class ParseNode; |
21 | 21 |
22 class Builder : public base::RefCountedThreadSafe<Builder> { | 22 class Builder : public base::RefCountedThreadSafe<Builder> { |
23 public: | 23 public: |
24 typedef base::Callback<void(const BuilderRecord*)> ResolvedCallback; | 24 typedef base::Callback<void(const BuilderRecord*)> ResolvedCallback; |
25 | 25 |
26 Builder(Loader* loader); | 26 explicit Builder(Loader* loader); |
27 | 27 |
28 // The resolved callback is called whenever a target has been resolved. This | 28 // The resolved callback is called whenever a target has been resolved. This |
29 // will be executed only on the main thread. | 29 // will be executed only on the main thread. |
30 void set_resolved_callback(const ResolvedCallback& cb) { | 30 void set_resolved_callback(const ResolvedCallback& cb) { |
31 resolved_callback_ = cb; | 31 resolved_callback_ = cb; |
32 } | 32 } |
33 | 33 |
34 Loader* loader() const { return loader_; } | 34 Loader* loader() const { return loader_; } |
35 | 35 |
36 void ItemDefined(scoped_ptr<Item> item); | 36 void ItemDefined(scoped_ptr<Item> item); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Owning pointers. | 132 // Owning pointers. |
133 typedef base::hash_map<Label, BuilderRecord*> RecordMap; | 133 typedef base::hash_map<Label, BuilderRecord*> RecordMap; |
134 RecordMap records_; | 134 RecordMap records_; |
135 | 135 |
136 ResolvedCallback resolved_callback_; | 136 ResolvedCallback resolved_callback_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(Builder); | 138 DISALLOW_COPY_AND_ASSIGN(Builder); |
139 }; | 139 }; |
140 | 140 |
141 #endif // TOOLS_GN_BUILDER_H_ | 141 #endif // TOOLS_GN_BUILDER_H_ |
OLD | NEW |