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

Unified Diff: base/values.cc

Issue 10389088: BinaryValue does not support NULL buffer. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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
« base/values.h ('K') | « base/values.h ('k') | no next file » | 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 8d7ca351d1e9cc6db28489f822a9f341906f04b5..0ee31ad54a3734a733d48926f3fd4dcd34a9c60b 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -299,25 +299,18 @@ bool StringValue::Equals(const Value* other) const {
///////////////////// BinaryValue ////////////////////
BinaryValue::~BinaryValue() {
- DCHECK(buffer_);
if (buffer_)
delete[] buffer_;
}
// static
BinaryValue* BinaryValue::Create(char* buffer, size_t size) {
- if (!buffer)
- return NULL;
-
return new BinaryValue(buffer, size);
}
// static
BinaryValue* BinaryValue::CreateWithCopiedBuffer(const char* buffer,
size_t size) {
- if (!buffer)
- return NULL;
-
char* buffer_copy = new char[size];
memcpy(buffer_copy, buffer, size);
return new BinaryValue(buffer_copy, size);
@@ -340,7 +333,6 @@ BinaryValue::BinaryValue(char* buffer, size_t size)
: Value(TYPE_BINARY),
buffer_(buffer),
size_(size) {
- DCHECK(buffer_);
}
///////////////////// DictionaryValue ////////////////////
« base/values.h ('K') | « base/values.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698