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

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

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 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 | « mojo/public/cpp/bindings/interface_request.h ('k') | mojo/public/cpp/bindings/lib/bindings_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 035f27cfc3cff66688497369340aabc59c5f99ac..3ffaf03a3d02c69b2690eb8b597166de1fdce6ba 100644
--- a/mojo/public/cpp/bindings/lib/array_serialization.h
+++ b/mojo/public/cpp/bindings/lib/array_serialization.h
@@ -240,10 +240,11 @@ struct ArraySerializer<InterfaceRequest<I>, MessagePipeHandle, false> {
}
};
-// Serializes and deserializes arrays of interfaces (interface pointers).
+// Serializes and deserializes arrays of interfaces (interface handles).
template <typename Interface>
-struct ArraySerializer<InterfacePtr<Interface>, Interface_Data, false> {
- static size_t GetSerializedSize(const Array<InterfacePtr<Interface>>& input) {
+struct ArraySerializer<InterfaceHandle<Interface>, Interface_Data, false> {
+ static size_t GetSerializedSize(
+ const Array<InterfaceHandle<Interface>>& input) {
return sizeof(Array_Data<Interface_Data>) +
Align(input.size() * sizeof(Interface_Data));
}
@@ -260,7 +261,7 @@ struct ArraySerializer<InterfacePtr<Interface>, Interface_Data, false> {
for (size_t i = 0; i < num_elements; ++i, ++it) {
// Transfer ownership of the handle.
- internal::InterfacePointerToData(it->Pass(), &output->at(i));
+ internal::InterfaceHandleToData(it->Pass(), &output->at(i));
if (!validate_params->element_is_nullable &&
!output->at(i).handle.is_valid()) {
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
@@ -276,10 +277,10 @@ struct ArraySerializer<InterfacePtr<Interface>, Interface_Data, false> {
}
static void DeserializeElements(Array_Data<Interface_Data>* input,
- Array<InterfacePtr<Interface>>* output) {
- auto result = Array<InterfacePtr<Interface>>::New(input->size());
+ Array<InterfaceHandle<Interface>>* output) {
+ auto result = Array<InterfaceHandle<Interface>>::New(input->size());
for (size_t i = 0; i < input->size(); ++i)
- internal::InterfaceDataToPointer(&input->at(i), &result.at(i));
+ internal::InterfaceDataToHandle(&input->at(i), &result.at(i));
output->Swap(&result);
}
};
« no previous file with comments | « mojo/public/cpp/bindings/interface_request.h ('k') | mojo/public/cpp/bindings/lib/bindings_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698