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 93% |
copy from third_party/mojo/src/mojo/edk/system/transport_data.cc |
copy to mojo/edk/system/transport_data.cc |
index 9bcecc4fa9cabac668ce6590d0f9590293eaf39c..d7515111bcebfaeb5213acb1bc76f1a1d3b7532d 100644 |
--- a/third_party/mojo/src/mojo/edk/system/transport_data.cc |
+++ b/mojo/edk/system/transport_data.cc |
@@ -2,17 +2,15 @@ |
// 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/transport_data.h" |
- |
-#include <string.h> |
+#include "mojo/edk/system/transport_data.h" |
#include "base/logging.h" |
-#include "third_party/mojo/src/mojo/edk/system/channel.h" |
-#include "third_party/mojo/src/mojo/edk/system/configuration.h" |
-#include "third_party/mojo/src/mojo/edk/system/message_in_transit.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 |
@@ -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,9 @@ 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); |
const Header* header = static_cast<const Header*>(buffer); |
const size_t num_handles = header->num_handles; |
@@ -332,11 +326,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 |