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

Unified Diff: base/values.cc

Issue 2817583007: Introduce base::Value::BlobStorage typedef (Closed)
Patch Set: Rebase Created 3 years, 8 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 | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 765cf90ec3136e8f7dbd276c701c31995d04ffb2..c8946fb5096a456540cdd53aef9fc2b34fe6b8a7 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -78,7 +78,7 @@ std::unique_ptr<Value> CopyWithoutEmptyChildren(const Value& node) {
// static
std::unique_ptr<Value> Value::CreateWithCopiedBuffer(const char* buffer,
size_t size) {
- return MakeUnique<Value>(std::vector<char>(buffer, buffer + size));
+ return MakeUnique<Value>(BlobStorage(buffer, buffer + size));
}
Value::Value(const Value& that) {
@@ -158,11 +158,11 @@ Value::Value(const string16& in_string) : type_(Type::STRING) {
Value::Value(StringPiece in_string) : Value(in_string.as_string()) {}
-Value::Value(const std::vector<char>& in_blob) : type_(Type::BINARY) {
+Value::Value(const BlobStorage& in_blob) : type_(Type::BINARY) {
binary_value_.Init(in_blob);
}
-Value::Value(std::vector<char>&& in_blob) noexcept : type_(Type::BINARY) {
+Value::Value(BlobStorage&& in_blob) noexcept : type_(Type::BINARY) {
binary_value_.Init(std::move(in_blob));
}
@@ -224,7 +224,7 @@ const std::string& Value::GetString() const {
return *string_value_;
}
-const std::vector<char>& Value::GetBlob() const {
+const Value::BlobStorage& Value::GetBlob() const {
CHECK(is_blob());
return *binary_value_;
}
« no previous file with comments | « base/values.h ('k') | base/values_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698