OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <set> | 5 #include <set> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "tools/gn/commands.h" | 9 #include "tools/gn/commands.h" |
10 #include "tools/gn/config.h" | 10 #include "tools/gn/config.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 template <typename T> | 115 template <typename T> |
116 ValuePtr RenderValue(const std::vector<T>& vector) { | 116 ValuePtr RenderValue(const std::vector<T>& vector) { |
117 auto res = base::MakeUnique<base::ListValue>(); | 117 auto res = base::MakeUnique<base::ListValue>(); |
118 for (const auto& v : vector) | 118 for (const auto& v : vector) |
119 res->Append(RenderValue(v)); | 119 res->Append(RenderValue(v)); |
120 | 120 |
121 return std::move(res); | 121 return std::move(res); |
122 } | 122 } |
123 | 123 |
124 ValuePtr RenderValue(const std::string& s, bool optional = false) { | 124 ValuePtr RenderValue(const std::string& s, bool optional = false) { |
125 return (s.empty() && optional) ? base::Value::CreateNullValue() | 125 return (s.empty() && optional) ? base::MakeUnique<base::Value>() |
126 : ValuePtr(new base::Value(s)); | 126 : ValuePtr(new base::Value(s)); |
127 } | 127 } |
128 | 128 |
129 ValuePtr RenderValue(const SourceDir& d) { | 129 ValuePtr RenderValue(const SourceDir& d) { |
130 return d.is_null() ? base::Value::CreateNullValue() | 130 return d.is_null() ? base::MakeUnique<base::Value>() |
131 : ValuePtr(new base::Value(FormatSourceDir(d))); | 131 : ValuePtr(new base::Value(FormatSourceDir(d))); |
132 } | 132 } |
133 | 133 |
134 ValuePtr RenderValue(const SourceFile& f) { | 134 ValuePtr RenderValue(const SourceFile& f) { |
135 return f.is_null() ? base::Value::CreateNullValue() | 135 return f.is_null() ? base::MakeUnique<base::Value>() |
136 : ValuePtr(new base::Value(f.value())); | 136 : ValuePtr(new base::Value(f.value())); |
137 } | 137 } |
138 | 138 |
139 ValuePtr RenderValue(const LibFile& lib) { | 139 ValuePtr RenderValue(const LibFile& lib) { |
140 if (lib.is_source_file()) | 140 if (lib.is_source_file()) |
141 return RenderValue(lib.source_file()); | 141 return RenderValue(lib.source_file()); |
142 return RenderValue(lib.value()); | 142 return RenderValue(lib.value()); |
143 } | 143 } |
144 | 144 |
145 template <class VectorType> | 145 template <class VectorType> |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 711 |
712 std::unique_ptr<base::DictionaryValue> DescBuilder::DescriptionForConfig( | 712 std::unique_ptr<base::DictionaryValue> DescBuilder::DescriptionForConfig( |
713 const Config* config, | 713 const Config* config, |
714 const std::string& what) { | 714 const std::string& what) { |
715 std::set<std::string> w; | 715 std::set<std::string> w; |
716 if (!what.empty()) | 716 if (!what.empty()) |
717 w.insert(what); | 717 w.insert(what); |
718 ConfigDescBuilder b(config, w); | 718 ConfigDescBuilder b(config, w); |
719 return b.BuildDescription(); | 719 return b.BuildDescription(); |
720 } | 720 } |
OLD | NEW |