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

Unified Diff: tools/gn/source_dir.cc

Issue 80463004: GN generator for GYP actions (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/source_dir.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/source_dir.cc
diff --git a/tools/gn/source_dir.cc b/tools/gn/source_dir.cc
index 025f428d6d19b3d4559f2b152f9e14b781ad900e..81340f94d2b4988af701bdfbae076310e4b571f8 100644
--- a/tools/gn/source_dir.cc
+++ b/tools/gn/source_dir.cc
@@ -11,9 +11,10 @@
namespace {
void AssertValueSourceDirString(const std::string& s) {
- DCHECK(!s.empty());
- DCHECK(s[0] == '/');
- DCHECK(EndsWithSlash(s));
+ if (!s.empty()) {
+ DCHECK(s[0] == '/');
+ DCHECK(EndsWithSlash(s));
+ }
}
} // namespace
@@ -28,6 +29,13 @@ SourceDir::SourceDir(const base::StringPiece& p)
AssertValueSourceDirString(value_);
}
+SourceDir::SourceDir(SwapIn, std::string* s) {
+ value_.swap(*s);
+ if (!EndsWithSlash(value_))
+ value_.push_back('/');
+ AssertValueSourceDirString(value_);
+}
+
SourceDir::~SourceDir() {
}
@@ -132,7 +140,7 @@ base::FilePath SourceDir::Resolve(const base::FilePath& source_root) const {
return source_root.Append(UTF8ToFilePath(converted));
}
-void SourceDir::SwapInValue(std::string* v) {
+void SourceDir::SwapValue(std::string* v) {
value_.swap(*v);
AssertValueSourceDirString(value_);
}
« no previous file with comments | « tools/gn/source_dir.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698