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

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

Issue 2660733002: Mojo C++ bindings: introduce an optional array to store transferred interface IDs in messages. (Closed)
Patch Set: . Created 3 years, 11 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 acfd4e3ec63892799dbc24b77c8a4edf330d3381..d2f8ecfd725cb2c6f6e3ec456354f4d3e999e243 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -288,8 +288,17 @@ struct ArraySerializer<
static size_t GetSerializedSize(UserTypeIterator* input,
SerializationContext* context) {
- return sizeof(Data) +
- Align(input->GetSize() * sizeof(typename Data::Element));
+ size_t element_count = input->GetSize();
+ if (BelongsTo<Element,
+ MojomTypeCategory::ASSOCIATED_INTERFACE |
+ MojomTypeCategory::ASSOCIATED_INTERFACE_REQUEST>::value) {
+ for (size_t i = 0; i < element_count; ++i) {
+ typename UserTypeIterator::GetNextResult next = input->GetNext();
+ size_t size = PrepareToSerialize<Element>(next, context);
+ DCHECK_EQ(size, 0u);
+ }
+ }
+ return sizeof(Data) + Align(element_count * sizeof(typename Data::Element));
}
static void SerializeElements(UserTypeIterator* input,
« no previous file with comments | « mojo/public/cpp/bindings/lib/array_internal.h ('k') | mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698