| Index: mojo/edk/system/message_in_transit.cc
|
| diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit.cc b/mojo/edk/system/message_in_transit.cc
|
| similarity index 78%
|
| copy from third_party/mojo/src/mojo/edk/system/message_in_transit.cc
|
| copy to mojo/edk/system/message_in_transit.cc
|
| index a40981d0cc6c8b373fcbf3237b3466085b5163e9..b85efc7fe583c92083e618ea9f0eede1015854ad 100644
|
| --- a/third_party/mojo/src/mojo/edk/system/message_in_transit.cc
|
| +++ b/mojo/edk/system/message_in_transit.cc
|
| @@ -2,18 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "third_party/mojo/src/mojo/edk/system/message_in_transit.h"
|
| +#include "mojo/edk/system/message_in_transit.h"
|
|
|
| #include <string.h>
|
|
|
| #include <ostream>
|
|
|
| #include "base/logging.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/configuration.h"
|
| -#include "third_party/mojo/src/mojo/edk/system/transport_data.h"
|
| +#include "mojo/edk/system/configuration.h"
|
| +#include "mojo/edk/system/transport_data.h"
|
|
|
| namespace mojo {
|
| -namespace system {
|
| +namespace edk {
|
|
|
| MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t
|
| MessageInTransit::kMessageAlignment;
|
| @@ -69,13 +69,12 @@ bool MessageInTransit::View::IsValid(size_t serialized_platform_handle_size,
|
| }
|
|
|
| MessageInTransit::MessageInTransit(Type type,
|
| - Subtype subtype,
|
| uint32_t num_bytes,
|
| const void* bytes)
|
| : main_buffer_size_(RoundUpMessageAlignment(sizeof(Header) + num_bytes)),
|
| main_buffer_(static_cast<char*>(
|
| base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
|
| - ConstructorHelper(type, subtype, num_bytes);
|
| + ConstructorHelper(type, num_bytes);
|
| if (bytes) {
|
| memcpy(MessageInTransit::bytes(), bytes, num_bytes);
|
| memset(static_cast<char*>(MessageInTransit::bytes()) + num_bytes, 0,
|
| @@ -85,19 +84,6 @@ MessageInTransit::MessageInTransit(Type type,
|
| }
|
| }
|
|
|
| -MessageInTransit::MessageInTransit(Type type,
|
| - Subtype subtype,
|
| - uint32_t num_bytes,
|
| - UserPointer<const void> bytes)
|
| - : main_buffer_size_(RoundUpMessageAlignment(sizeof(Header) + num_bytes)),
|
| - main_buffer_(static_cast<char*>(
|
| - base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
|
| - ConstructorHelper(type, subtype, num_bytes);
|
| - bytes.GetArray(MessageInTransit::bytes(), num_bytes);
|
| - memset(static_cast<char*>(MessageInTransit::bytes()) + num_bytes, 0,
|
| - main_buffer_size_ - sizeof(Header) - num_bytes);
|
| -}
|
| -
|
| MessageInTransit::MessageInTransit(const View& message_view)
|
| : main_buffer_size_(message_view.main_buffer_size()),
|
| main_buffer_(static_cast<char*>(
|
| @@ -115,8 +101,6 @@ MessageInTransit::~MessageInTransit() {
|
| for (size_t i = 0; i < dispatchers_->size(); i++) {
|
| if (!(*dispatchers_)[i])
|
| continue;
|
| -
|
| - DCHECK((*dispatchers_)[i]->HasOneRef());
|
| (*dispatchers_)[i]->Close();
|
| }
|
| }
|
| @@ -150,10 +134,6 @@ void MessageInTransit::SetDispatchers(
|
| DCHECK(!transport_data_);
|
|
|
| dispatchers_ = dispatchers.Pass();
|
| -#ifndef NDEBUG
|
| - for (size_t i = 0; i < dispatchers_->size(); i++)
|
| - DCHECK(!(*dispatchers_)[i] || (*dispatchers_)[i]->HasOneRef());
|
| -#endif
|
| }
|
|
|
| void MessageInTransit::SetTransportData(
|
| @@ -166,29 +146,24 @@ void MessageInTransit::SetTransportData(
|
| UpdateTotalSize();
|
| }
|
|
|
| -void MessageInTransit::SerializeAndCloseDispatchers(Channel* channel) {
|
| - DCHECK(channel);
|
| +void MessageInTransit::SerializeAndCloseDispatchers() {
|
| DCHECK(!transport_data_);
|
|
|
| if (!dispatchers_ || !dispatchers_->size())
|
| return;
|
|
|
| - transport_data_.reset(new TransportData(dispatchers_.Pass(), channel));
|
| + transport_data_.reset(new TransportData(dispatchers_.Pass()));
|
|
|
| // Update the sizes in the message header.
|
| UpdateTotalSize();
|
| }
|
|
|
| void MessageInTransit::ConstructorHelper(Type type,
|
| - Subtype subtype,
|
| uint32_t num_bytes) {
|
| DCHECK_LE(num_bytes, GetConfiguration().max_message_num_bytes);
|
|
|
| // |total_size| is updated below, from the other values.
|
| header()->type = type;
|
| - header()->subtype = subtype;
|
| - header()->source_id = ChannelEndpointId();
|
| - header()->destination_id = ChannelEndpointId();
|
| header()->num_bytes = num_bytes;
|
| header()->unused = 0;
|
| // Note: If dispatchers are subsequently attached, then |total_size| will have
|
| @@ -205,5 +180,5 @@ void MessageInTransit::UpdateTotalSize() {
|
| }
|
| }
|
|
|
| -} // namespace system
|
| +} // namespace edk
|
| } // namespace mojo
|
|
|