| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/edk/system/transport_data.h" | 5 #include "mojo/edk/system/transport_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/edk/system/configuration.h" | 8 #include "mojo/edk/system/configuration.h" |
| 9 #include "mojo/edk/system/message_in_transit.h" | 9 #include "mojo/edk/system/message_in_transit.h" |
| 10 #include "mojo/edk/system/raw_channel.h" | 10 #include "mojo/edk/system/raw_channel.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 namespace edk { | 13 namespace edk { |
| 14 | 14 |
| 15 // The maximum amount of space needed per platform handle. | 15 // The maximum amount of space needed per platform handle. |
| 16 // (|{Channel,RawChannel}::GetSerializedPlatformHandleSize()| should always | 16 // (|{Channel,RawChannel}::GetSerializedPlatformHandleSize()| should always |
| 17 // return a value which is at most this. This is only used to calculate | 17 // return a value which is at most this. This is only used to calculate |
| 18 // |TransportData::kMaxBufferSize|. This value should be a multiple of the | 18 // |TransportData::kMaxBufferSize|. This value should be a multiple of the |
| 19 // alignment in order to simplify calculations, even though the actual amount of | 19 // alignment in order to simplify calculations, even though the actual amount of |
| 20 // space needed need not be a multiple of the alignment. | 20 // space needed need not be a multiple of the alignment. |
| 21 const size_t kMaxSizePerPlatformHandle = 16; | 21 const size_t kMaxSizePerPlatformHandle = 8; |
| 22 static_assert(kMaxSizePerPlatformHandle % MessageInTransit::kMessageAlignment == | 22 static_assert(kMaxSizePerPlatformHandle % MessageInTransit::kMessageAlignment == |
| 23 0, | 23 0, |
| 24 "kMaxSizePerPlatformHandle not a multiple of alignment"); | 24 "kMaxSizePerPlatformHandle not a multiple of alignment"); |
| 25 | 25 |
| 26 MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t | 26 MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t |
| 27 TransportData::kMaxSerializedDispatcherSize; | 27 TransportData::kMaxSerializedDispatcherSize; |
| 28 | 28 |
| 29 // static | 29 // static |
| 30 size_t TransportData::GetMaxBufferSize() { | 30 size_t TransportData::GetMaxBufferSize() { |
| 31 // In additional to the header, for each attached (Mojo) handle there'll be a | 31 // In additional to the header, for each attached (Mojo) handle there'll be a |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 const void* source = static_cast<const char*>(buffer) + offset; | 324 const void* source = static_cast<const char*>(buffer) + offset; |
| 325 (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize( | 325 (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize( |
| 326 handle_table[i].type, source, size, platform_handles.get()); | 326 handle_table[i].type, source, size, platform_handles.get()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 return dispatchers.Pass(); | 329 return dispatchers.Pass(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 } // namespace edk | 332 } // namespace edk |
| 333 } // namespace mojo | 333 } // namespace mojo |
| OLD | NEW |