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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/builder_record.h ('k') | tools/gn/builder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/builder_record.cc
diff --git a/tools/gn/builder_record.cc b/tools/gn/builder_record.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80ecc2c1f7c42233ee66ef89fe195bb57cd36211
--- /dev/null
+++ b/tools/gn/builder_record.cc
@@ -0,0 +1,69 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/gn/builder_record.h"
+
+#include "tools/gn/item.h"
+
+BuilderRecord::BuilderRecord(ItemType type, const Label& label)
+ : type_(type),
+ label_(label),
+ originally_referenced_from_(NULL),
+ should_generate_(false),
+ resolved_(false) {
+}
+
+BuilderRecord::~BuilderRecord() {
+}
+
+// static
+const char* BuilderRecord::GetNameForType(ItemType type) {
+ switch (type) {
+ case ITEM_TARGET:
+ return "target";
+ case ITEM_CONFIG:
+ return "config";
+ case ITEM_TOOLCHAIN:
+ return "toolchain";
+ case ITEM_UNKNOWN:
+ default:
+ return "unknown";
+ }
+}
+
+// static
+bool BuilderRecord::IsItemOfType(const Item* item, ItemType type) {
+ switch (type) {
+ case ITEM_TARGET:
+ return !!item->AsTarget();
+ case ITEM_CONFIG:
+ return !!item->AsConfig();
+ case ITEM_TOOLCHAIN:
+ return !!item->AsToolchain();
+ case ITEM_UNKNOWN:
+ default:
+ return false;
+ }
+}
+
+// static
+BuilderRecord::ItemType BuilderRecord::TypeOfItem(const Item* item) {
+ if (item->AsTarget())
+ return ITEM_TARGET;
+ if (item->AsConfig())
+ return ITEM_CONFIG;
+ if (item->AsToolchain())
+ return ITEM_TOOLCHAIN;
+
+ NOTREACHED();
+ return ITEM_UNKNOWN;
+}
+
+void BuilderRecord::AddDep(BuilderRecord* record) {
+ all_deps_.insert(record);
+ if (!record->resolved()) {
+ unresolved_deps_.insert(record);
+ record->waiting_on_resolution_.insert(this);
+ }
+}
« 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