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

Unified Diff: mojo/public/cpp/bindings/lib/serialization.h

Issue 2604953003: Remove internal uses of mojo::Array and mojo::WTFArray. (Closed)
Patch Set: Created 4 years 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
Index: mojo/public/cpp/bindings/lib/serialization.h
diff --git a/mojo/public/cpp/bindings/lib/serialization.h b/mojo/public/cpp/bindings/lib/serialization.h
index aaed4714333708786831438cfeac64417cca6f03..da5e6a6277f279b296fa9755c54a969cc6bf7b35 100644
--- a/mojo/public/cpp/bindings/lib/serialization.h
+++ b/mojo/public/cpp/bindings/lib/serialization.h
@@ -42,7 +42,7 @@ DataArrayType StructSerializeImpl(UserType* input) {
void* result_buffer = &result.front();
// The serialization logic requires that the buffer is 8-byte aligned. If the
// result buffer is not properly aligned, we have to do an extra copy. In
- // practice, this should never happen for mojo::Array (backed by std::vector).
+ // practice, this should never happen for std::vector.
bool need_copy = !IsAligned(result_buffer);
if (need_copy) {
@@ -70,11 +70,9 @@ bool StructDeserializeImpl(const DataArrayType& input, UserType* output) {
"Unexpected type.");
using DataType = typename MojomTypeTraits<MojomType>::Data;
- if (input.is_null())
- return false;
-
+ // TODO(sammc): Use DataArrayType::empty() once WTF::Vector::empty() exists.
void* input_buffer =
- input.empty()
+ input.size() == 0
? nullptr
: const_cast<void*>(reinterpret_cast<const void*>(&input.front()));

Powered by Google App Engine
This is Rietveld 408576698