| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/message_in_transit.h" | 5 #include "mojo/edk/system/message_in_transit.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "mojo/edk/system/configuration.h" | 12 #include "mojo/edk/system/configuration.h" |
| 13 #include "mojo/edk/system/transport_data.h" | 13 #include "mojo/edk/system/transport_data.h" |
| 14 | 14 |
| 15 using mojo::platform::AlignedAlloc; | 15 using mojo::platform::AlignedAlloc; |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 namespace system { | 18 namespace system { |
| 19 | 19 |
| 20 MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t | 20 const size_t MessageInTransit::kMessageAlignment; |
| 21 MessageInTransit::kMessageAlignment; | |
| 22 | 21 |
| 23 struct MessageInTransit::PrivateStructForCompileAsserts { | 22 struct MessageInTransit::PrivateStructForCompileAsserts { |
| 24 // The size of |Header| must be a multiple of the alignment. | 23 // The size of |Header| must be a multiple of the alignment. |
| 25 static_assert(sizeof(Header) % kMessageAlignment == 0, | 24 static_assert(sizeof(Header) % kMessageAlignment == 0, |
| 26 "sizeof(MessageInTransit::Header) invalid"); | 25 "sizeof(MessageInTransit::Header) invalid"); |
| 27 }; | 26 }; |
| 28 | 27 |
| 29 MessageInTransit::View::View(size_t message_size, const void* buffer) | 28 MessageInTransit::View::View(size_t message_size, const void* buffer) |
| 30 : buffer_(buffer) { | 29 : buffer_(buffer) { |
| 31 size_t next_message_size = 0; | 30 size_t next_message_size = 0; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); | 200 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); |
| 202 header()->total_size = static_cast<uint32_t>(main_buffer_size_); | 201 header()->total_size = static_cast<uint32_t>(main_buffer_size_); |
| 203 if (transport_data_) { | 202 if (transport_data_) { |
| 204 header()->total_size += | 203 header()->total_size += |
| 205 static_cast<uint32_t>(transport_data_->buffer_size()); | 204 static_cast<uint32_t>(transport_data_->buffer_size()); |
| 206 } | 205 } |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace system | 208 } // namespace system |
| 210 } // namespace mojo | 209 } // namespace mojo |
| OLD | NEW |