| Index: mojo/edk/system/transport_data.cc
|
| diff --git a/third_party/mojo/src/mojo/edk/system/transport_data.cc b/mojo/edk/system/transport_data.cc
|
| similarity index 94%
|
| copy from third_party/mojo/src/mojo/edk/system/transport_data.cc
|
| copy to mojo/edk/system/transport_data.cc
|
| index 8d9b229b08a4d6b85ed052ea51a90d067dd755b3..c203e672f00c63997d302313c8d9f93765f3a40c 100644
|
| --- a/third_party/mojo/src/mojo/edk/system/transport_data.cc
|
| +++ b/mojo/edk/system/transport_data.cc
|
| @@ -4,15 +4,13 @@
|
|
|
| #include "mojo/edk/system/transport_data.h"
|
|
|
| -#include <string.h>
|
| -
|
| #include "base/logging.h"
|
| -#include "mojo/edk/system/channel.h"
|
| #include "mojo/edk/system/configuration.h"
|
| #include "mojo/edk/system/message_in_transit.h"
|
| +#include "mojo/edk/system/raw_channel.h"
|
|
|
| namespace mojo {
|
| -namespace system {
|
| +namespace edk {
|
|
|
| // The maximum amount of space needed per platform handle.
|
| // (|{Channel,RawChannel}::GetSerializedPlatformHandleSize()| should always
|
| @@ -20,7 +18,7 @@ namespace system {
|
| // |TransportData::kMaxBufferSize|. This value should be a multiple of the
|
| // alignment in order to simplify calculations, even though the actual amount of
|
| // space needed need not be a multiple of the alignment.
|
| -const size_t kMaxSizePerPlatformHandle = 8;
|
| +const size_t kMaxSizePerPlatformHandle = 16;
|
| static_assert(kMaxSizePerPlatformHandle % MessageInTransit::kMessageAlignment ==
|
| 0,
|
| "kMaxSizePerPlatformHandle not a multiple of alignment");
|
| @@ -60,11 +58,9 @@ struct TransportData::PrivateStructForCompileAsserts {
|
| "alignment");
|
| };
|
|
|
| -TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
| - Channel* channel)
|
| +TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers)
|
| : buffer_size_() {
|
| DCHECK(dispatchers);
|
| - DCHECK(channel);
|
|
|
| const size_t num_handles = dispatchers->size();
|
| DCHECK_GT(num_handles, 0u);
|
| @@ -87,7 +83,7 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
| size_t max_size = 0;
|
| size_t max_platform_handles = 0;
|
| Dispatcher::TransportDataAccess::StartSerialize(
|
| - dispatcher, channel, &max_size, &max_platform_handles);
|
| + dispatcher, &max_size, &max_platform_handles);
|
|
|
| DCHECK_LE(max_size, kMaxSerializedDispatcherSize);
|
| estimated_size += MessageInTransit::RoundUpMessageAlignment(max_size);
|
| @@ -106,7 +102,7 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
|
|
| size_t size_per_platform_handle = 0;
|
| if (estimated_num_platform_handles > 0) {
|
| - size_per_platform_handle = channel->GetSerializedPlatformHandleSize();
|
| + size_per_platform_handle = RawChannel::GetSerializedPlatformHandleSize();
|
| DCHECK_LE(size_per_platform_handle, kMaxSizePerPlatformHandle);
|
| estimated_size += estimated_num_platform_handles * size_per_platform_handle;
|
| estimated_size = MessageInTransit::RoundUpMessageAlignment(estimated_size);
|
| @@ -122,7 +118,7 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
|
|
| if (estimated_num_platform_handles > 0) {
|
| DCHECK(!platform_handles_);
|
| - platform_handles_.reset(new embedder::PlatformHandleVector());
|
| + platform_handles_.reset(new PlatformHandleVector());
|
| }
|
|
|
| Header* header = reinterpret_cast<Header*>(buffer_.get());
|
| @@ -149,7 +145,7 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
| void* destination = buffer_.get() + current_offset;
|
| size_t actual_size = 0;
|
| if (Dispatcher::TransportDataAccess::EndSerializeAndClose(
|
| - dispatcher, channel, destination, &actual_size,
|
| + dispatcher, destination, &actual_size,
|
| platform_handles_.get())) {
|
| handle_table[i].type = static_cast<int32_t>(dispatcher->GetType());
|
| handle_table[i].offset = static_cast<uint32_t>(current_offset);
|
| @@ -192,7 +188,7 @@ TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers,
|
| }
|
|
|
| TransportData::TransportData(
|
| - embedder::ScopedPlatformHandleVectorPtr platform_handles,
|
| + ScopedPlatformHandleVectorPtr platform_handles,
|
| size_t serialized_platform_handle_size)
|
| : buffer_size_(), platform_handles_(platform_handles.Pass()) {
|
| buffer_size_ = MessageInTransit::RoundUpMessageAlignment(
|
| @@ -309,11 +305,10 @@ void TransportData::GetPlatformHandleTable(const void* transport_data_buffer,
|
| scoped_ptr<DispatcherVector> TransportData::DeserializeDispatchers(
|
| const void* buffer,
|
| size_t buffer_size,
|
| - embedder::ScopedPlatformHandleVectorPtr platform_handles,
|
| - Channel* channel) {
|
| + ScopedPlatformHandleVectorPtr platform_handles) {
|
| DCHECK(buffer);
|
| DCHECK_GT(buffer_size, 0u);
|
| - DCHECK(channel);
|
| + //DCHECK(channel);
|
|
|
| const Header* header = static_cast<const Header*>(buffer);
|
| const size_t num_handles = header->num_handles;
|
| @@ -332,11 +327,11 @@ scoped_ptr<DispatcherVector> TransportData::DeserializeDispatchers(
|
|
|
| const void* source = static_cast<const char*>(buffer) + offset;
|
| (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize(
|
| - channel, handle_table[i].type, source, size, platform_handles.get());
|
| + handle_table[i].type, source, size, platform_handles.get());
|
| }
|
|
|
| return dispatchers.Pass();
|
| }
|
|
|
| -} // namespace system
|
| +} // namespace edk
|
| } // namespace mojo
|
|
|