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

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

Issue 2174843003: cc mojo: Use ArrayDataViews in RenderPasses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete quads.typemap Created 4 years, 5 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
Index: mojo/public/cpp/bindings/lib/array_serialization.h
diff --git a/mojo/public/cpp/bindings/lib/array_serialization.h b/mojo/public/cpp/bindings/lib/array_serialization.h
index 5db27a5502a5a238ec1a6765d8f2854248a36e36..d03529422160b4f891cf6ae47bdfc331d4f4b2fb 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -46,7 +46,7 @@ class ArrayIterator<Traits, MaybeConstUserType, true> {
using GetNextResult =
decltype(Traits::GetValue(std::declval<IteratorType&>()));
GetNextResult GetNext() {
- auto& value = Traits::GetValue(iter_);
+ GetNextResult value = Traits::GetValue(iter_);
Traits::AdvanceIterator(iter_);
return value;
}
@@ -361,8 +361,10 @@ struct ArraySerializer<MojomType,
SerializationContext* context) {
size_t element_count = input->GetSize();
size_t size = sizeof(Data) + element_count * sizeof(typename Data::Element);
- for (size_t i = 0; i < element_count; ++i)
- size += PrepareToSerialize<Element>(input->GetNext(), context);
+ for (size_t i = 0; i < element_count; ++i) {
+ typename UserTypeIterator::GetNextResult next = input->GetNext();
yzshen1 2016/07/28 18:25:19 Please also update the documentation of array_trai
Fady Samuel 2016/07/28 19:53:31 Done.
+ size += PrepareToSerialize<Element>(next, context);
+ }
return size;
}
@@ -374,7 +376,8 @@ struct ArraySerializer<MojomType,
size_t size = input->GetSize();
for (size_t i = 0; i < size; ++i) {
DataElementPtr data_ptr;
- SerializeCaller<Element>::Run(input->GetNext(), buf, &data_ptr,
+ typename UserTypeIterator::GetNextResult next = input->GetNext();
+ SerializeCaller<Element>::Run(next, buf, &data_ptr,
validate_params->element_validate_params,
context);
output->at(i).Set(data_ptr);

Powered by Google App Engine
This is Rietveld 408576698