| Index: mojo/edk/system/channel.h
|
| diff --git a/mojo/edk/system/channel.h b/mojo/edk/system/channel.h
|
| index 0efc0ac0d12113d15267fda9bb2c62f5d2311d91..61bc40f20c5d244afb5046a116b954c8ece0b775 100644
|
| --- a/mojo/edk/system/channel.h
|
| +++ b/mojo/edk/system/channel.h
|
| @@ -10,6 +10,7 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "base/process/process_handle.h"
|
| #include "base/task_runner.h"
|
| +#include "mojo/edk/embedder/connection_param.h"
|
| #include "mojo/edk/embedder/platform_handle_vector.h"
|
| #include "mojo/edk/embedder/scoped_platform_handle.h"
|
|
|
| @@ -102,7 +103,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Channel
|
| // Actual number of Mach ports encoded in the extra header.
|
| uint16_t num_ports;
|
|
|
| - // Array of encoded Mach ports. If |num_ports| > 0, |entires[0]| through
|
| + // Array of encoded Mach ports. If |num_ports| > 0, |entries[0]| through
|
| // to |entries[num_ports-1]| inclusive are valid.
|
| MachPortsEntry entries[0];
|
| };
|
| @@ -116,6 +117,28 @@ class MOJO_SYSTEM_IMPL_EXPORT Channel
|
| };
|
| static_assert(sizeof(HandleEntry) == 4,
|
| "sizeof(HandleEntry) must be 4 bytes");
|
| +#elif defined(OS_ANDROID)
|
| + struct ParcelableEntry {
|
| + // Index of the parcelable in the original vector of PlatformHandles.
|
| + uint16_t index;
|
| +
|
| + // The ID of a parcelable sent through the side channel.
|
| + uint32_t id;
|
| + };
|
| + static_assert(sizeof(ParcelableEntry) == 6,
|
| + "sizeof(ParcelableEntry) must be 6 bytes");
|
| +
|
| + // Structure of the extra header field when present on Android.
|
| + struct ParcelableExtraHeader {
|
| + // Actual number of parcelables encoded in the extra header.
|
| + uint16_t num_parcelables;
|
| +
|
| + // Array of parcelable IDs. If |num_ports| > 0, |entries[0]| through
|
| + // to |entries[num_ports-1]| inclusive are valid.
|
| + ParcelableEntry entries[0];
|
| + };
|
| + static_assert(sizeof(ParcelableExtraHeader) == 2,
|
| + "sizeof(ParcelableExtraHeader) must be 2 bytes");
|
| #endif
|
| #pragma pack(pop)
|
|
|
| @@ -159,6 +182,12 @@ class MOJO_SYSTEM_IMPL_EXPORT Channel
|
| // such as Mach ports, will be removed.
|
| ScopedPlatformHandleVectorPtr TakeHandlesForTransport();
|
|
|
| +#if defined(OS_ANDROID)
|
| + using IDAndParcelableVector = std::vector<
|
| + std::pair<uint32_t, base::android::ScopedJavaLocalRef<jobject>>>;
|
| + IDAndParcelableVector TakeParcelablesForTransport();
|
| +#endif
|
| +
|
| #if defined(OS_WIN)
|
| // Prepares the handles in this message for use in a different process.
|
| // Upon calling this the handles should belong to |from_process|; after the
|
| @@ -185,6 +214,10 @@ class MOJO_SYSTEM_IMPL_EXPORT Channel
|
| #elif defined(OS_MACOSX) && !defined(OS_IOS)
|
| // On OSX, handles are serialised into the extra header section.
|
| MachPortsExtraHeader* mach_ports_header_ = nullptr;
|
| +#elif defined(OS_ANDROID)
|
| + // On Android, handles for parcelable are sent on a side channel, IDs are
|
| + // sent on the mian channel.
|
| + ParcelableExtraHeader* parcelable_header_ = nullptr;
|
| #endif
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Message);
|
| @@ -213,7 +246,7 @@ class MOJO_SYSTEM_IMPL_EXPORT Channel
|
| // |delegate| is destroyed.
|
| static scoped_refptr<Channel> Create(
|
| Delegate* delegate,
|
| - ScopedPlatformHandle platform_handle,
|
| + ConnectionParam connection_param,
|
| scoped_refptr<base::TaskRunner> io_task_runner);
|
|
|
| // Request that the channel be shut down. This should always be called before
|
|
|