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

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

Issue 56433003: GN threading refactor (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/builder_record.h ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "tools/gn/builder_record.h"
6
7 #include "tools/gn/item.h"
8
9 BuilderRecord::BuilderRecord(ItemType type, const Label& label)
10 : type_(type),
11 label_(label),
12 originally_referenced_from_(NULL),
13 should_generate_(false),
14 resolved_(false) {
15 }
16
17 BuilderRecord::~BuilderRecord() {
18 }
19
20 // static
21 const char* BuilderRecord::GetNameForType(ItemType type) {
22 switch (type) {
23 case ITEM_TARGET:
24 return "target";
25 case ITEM_CONFIG:
26 return "config";
27 case ITEM_TOOLCHAIN:
28 return "toolchain";
29 case ITEM_UNKNOWN:
30 default:
31 return "unknown";
32 }
33 }
34
35 // static
36 bool BuilderRecord::IsItemOfType(const Item* item, ItemType type) {
37 switch (type) {
38 case ITEM_TARGET:
39 return !!item->AsTarget();
40 case ITEM_CONFIG:
41 return !!item->AsConfig();
42 case ITEM_TOOLCHAIN:
43 return !!item->AsToolchain();
44 case ITEM_UNKNOWN:
45 default:
46 return false;
47 }
48 }
49
50 // static
51 BuilderRecord::ItemType BuilderRecord::TypeOfItem(const Item* item) {
52 if (item->AsTarget())
53 return ITEM_TARGET;
54 if (item->AsConfig())
55 return ITEM_CONFIG;
56 if (item->AsToolchain())
57 return ITEM_TOOLCHAIN;
58
59 NOTREACHED();
60 return ITEM_UNKNOWN;
61 }
62
63 void BuilderRecord::AddDep(BuilderRecord* record) {
64 all_deps_.insert(record);
65 if (!record->resolved()) {
66 unresolved_deps_.insert(record);
67 record->waiting_on_resolution_.insert(this);
68 }
69 }
OLDNEW
« no previous file with comments | « tools/gn/builder_record.h ('k') | tools/gn/builder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698