Index: mojo/public/cpp/bindings/lib/bindings_serialization.h |
diff --git a/mojo/public/cpp/bindings/lib/bindings_serialization.h b/mojo/public/cpp/bindings/lib/bindings_serialization.h |
index 5e2f9a775ca89e8fa11243304c7d3173627488e4..0da7d965105cc0c87fd671b4f52c22904a5c3d91 100644 |
--- a/mojo/public/cpp/bindings/lib/bindings_serialization.h |
+++ b/mojo/public/cpp/bindings/lib/bindings_serialization.h |
@@ -7,6 +7,8 @@ |
#include <vector> |
+#include "base/memory/ref_counted.h" |
+#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
#include "mojo/public/cpp/bindings/interface_ptr.h" |
#include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
#include "mojo/public/cpp/system/core.h" |
@@ -14,6 +16,8 @@ |
namespace mojo { |
namespace internal { |
+class MultiplexRouter; |
+ |
// Please note that this is a different value than |mojo::kInvalidHandleValue|, |
// which is the "decoded" invalid handle. |
const MojoHandle kEncodedInvalidHandleValue = static_cast<MojoHandle>(-1); |
@@ -85,6 +89,37 @@ inline void InterfaceDataToPointer(Interface_Data* input, |
MakeScopedHandle(FetchAndReset(&input->handle)), input->version)); |
} |
+template <typename T> |
+inline void AssociatedInterfacePtrInfoToData( |
+ AssociatedInterfacePtrInfo<T> input, |
+ AssociatedInterface_Data* output) { |
+ output->version = input.version(); |
+ output->interface_id = |
+ AssociatedInterfacePtrInfoHelper::PassHandle(&input).release(); |
+} |
+ |
+template <typename T> |
+inline void AssociatedInterfaceDataToPtrInfo( |
+ AssociatedInterface_Data* input, |
+ AssociatedInterfacePtrInfo<T>* output, |
+ MultiplexRouter* router) { |
+ AssociatedInterfacePtrInfoHelper::SetHandle( |
+ output, |
+ router->CreateLocalEndpointHandle(FetchAndReset(&input->interface_id))); |
+ output->set_version(input->version); |
+} |
+ |
+// Context information for serialization/deserialization routines. |
+struct SerializationContext { |
+ SerializationContext(); |
+ explicit SerializationContext(scoped_refptr<MultiplexRouter> in_router); |
+ |
+ ~SerializationContext(); |
+ |
+ // Used to serialize/deserialize associated interface pointers and requests. |
+ scoped_refptr<MultiplexRouter> router; |
+}; |
+ |
} // namespace internal |
} // namespace mojo |