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

Unified Diff: tools/gn/visibility.cc

Issue 2156173003: Re-land r406064 "[GN] Add JSON project writer". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clear dependency Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/visibility.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/visibility.cc
diff --git a/tools/gn/visibility.cc b/tools/gn/visibility.cc
index a61a5cd9c45f7effb57fd053be21ddaf29a6122e..b32586ce13e62537cca0796dccb82a840d8091a5 100644
--- a/tools/gn/visibility.cc
+++ b/tools/gn/visibility.cc
@@ -4,8 +4,10 @@
#include "tools/gn/visibility.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
+#include "base/values.h"
#include "tools/gn/err.h"
#include "tools/gn/filesystem_utils.h"
#include "tools/gn/item.h"
@@ -83,6 +85,14 @@ std::string Visibility::Describe(int indent, bool include_brackets) const {
return result;
}
+std::unique_ptr<base::Value> Visibility::AsValue() const {
+ auto* res = new base::ListValue();
+ for (const auto& pattern : patterns_)
+ res->AppendString(pattern.Describe());
+
+ return WrapUnique(res);
+}
+
// static
bool Visibility::CheckItemVisibility(const Item* from,
const Item* to,
@@ -93,7 +103,7 @@ bool Visibility::CheckItemVisibility(const Item* from,
"The item " + from->label().GetUserVisibleName(false) + "\n"
"can not depend on " + to_label + "\n"
"because it is not in " + to_label + "'s visibility list: " +
- to->visibility().Describe(0, true));
+ to->visibility().Describe(0, true));
return false;
}
return true;
« no previous file with comments | « tools/gn/visibility.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698