| 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_);
|
| }
|
|
|