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 <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 #if DCHECK_IS_ON | 144 #if DCHECK_IS_ON |
145 size_t old_platform_handles_size = | 145 size_t old_platform_handles_size = |
146 platform_handles_ ? platform_handles_->size() : 0; | 146 platform_handles_ ? platform_handles_->size() : 0; |
147 #endif | 147 #endif |
148 | 148 |
149 void* destination = buffer_.get() + current_offset; | 149 void* destination = buffer_.get() + current_offset; |
150 size_t actual_size = 0; | 150 size_t actual_size = 0; |
151 if (Dispatcher::TransportDataAccess::EndSerializeAndClose( | 151 if (Dispatcher::TransportDataAccess::EndSerializeAndClose( |
152 dispatcher, | 152 dispatcher, channel, destination, &actual_size, |
153 channel, | |
154 destination, | |
155 &actual_size, | |
156 platform_handles_.get())) { | 153 platform_handles_.get())) { |
157 handle_table[i].type = static_cast<int32_t>(dispatcher->GetType()); | 154 handle_table[i].type = static_cast<int32_t>(dispatcher->GetType()); |
158 handle_table[i].offset = static_cast<uint32_t>(current_offset); | 155 handle_table[i].offset = static_cast<uint32_t>(current_offset); |
159 handle_table[i].size = static_cast<uint32_t>(actual_size); | 156 handle_table[i].size = static_cast<uint32_t>(actual_size); |
160 // (Okay to not set |unused| since we cleared the entire buffer.) | 157 // (Okay to not set |unused| since we cleared the entire buffer.) |
161 | 158 |
162 #if DCHECK_IS_ON | 159 #if DCHECK_IS_ON |
163 DCHECK_LE(actual_size, all_max_sizes[i]); | 160 DCHECK_LE(actual_size, all_max_sizes[i]); |
164 DCHECK_LE(platform_handles_ | 161 DCHECK_LE(platform_handles_ |
165 ? (platform_handles_->size() - old_platform_handles_size) | 162 ? (platform_handles_->size() - old_platform_handles_size) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const void* source = static_cast<const char*>(buffer) + offset; | 335 const void* source = static_cast<const char*>(buffer) + offset; |
339 (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize( | 336 (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize( |
340 channel, handle_table[i].type, source, size, platform_handles.get()); | 337 channel, handle_table[i].type, source, size, platform_handles.get()); |
341 } | 338 } |
342 | 339 |
343 return dispatchers.Pass(); | 340 return dispatchers.Pass(); |
344 } | 341 } |
345 | 342 |
346 } // namespace system | 343 } // namespace system |
347 } // namespace mojo | 344 } // namespace mojo |
OLD | NEW |