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

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

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/item_node.h ('k') | tools/gn/item_tree.h » ('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/item_node.h"
6
7 #include <algorithm>
8
9 #include "base/callback.h"
10 #include "base/logging.h"
11 #include "tools/gn/item.h"
12
13 ItemNode::ItemNode(Item* i)
14 : state_(REFERENCED),
15 item_(i) {
16 }
17
18 ItemNode::~ItemNode() {
19 }
20
21 void ItemNode::AddDependency(ItemNode* node) {
22 if (direct_dependencies_.find(node) != direct_dependencies_.end())
23 return; // Already have this dep.
24 direct_dependencies_.insert(node);
25
26 if (node->state() != RESOLVED) {
27 // Wire up the pending resolution info.
28 unresolved_dependencies_.insert(node);
29 node->waiting_on_resolution_.insert(this);
30 }
31 }
32
33 void ItemNode::MarkDirectDependencyResolved(ItemNode* node) {
34 DCHECK(unresolved_dependencies_.find(node) != unresolved_dependencies_.end());
35 unresolved_dependencies_.erase(node);
36 }
37
38 void ItemNode::SwapOutWaitingDependencySet(ItemNodeSet* out_set) {
39 waiting_on_resolution_.swap(*out_set);
40 }
41
42 void ItemNode::SetGenerated() {
43 state_ = GENERATED;
44 }
45
46 void ItemNode::SetResolved() {
47 state_ = RESOLVED;
48
49 if (!resolved_closure_.is_null())
50 resolved_closure_.Run();
51 }
OLDNEW
« no previous file with comments | « tools/gn/item_node.h ('k') | tools/gn/item_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698