| 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 "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 #endif | 170 #endif |
| 171 } | 171 } |
| 172 | 172 |
| 173 void MessageInTransit::SetTransportData( | 173 void MessageInTransit::SetTransportData( |
| 174 scoped_ptr<TransportData> transport_data) { | 174 scoped_ptr<TransportData> transport_data) { |
| 175 DCHECK(transport_data); | 175 DCHECK(transport_data); |
| 176 DCHECK(!transport_data_); | 176 DCHECK(!transport_data_); |
| 177 DCHECK(!dispatchers_); | 177 DCHECK(!dispatchers_); |
| 178 | 178 |
| 179 transport_data_ = transport_data.Pass(); | 179 transport_data_ = transport_data.Pass(); |
| 180 UpdateTotalSize(); |
| 180 } | 181 } |
| 181 | 182 |
| 182 void MessageInTransit::SerializeAndCloseDispatchers(Channel* channel) { | 183 void MessageInTransit::SerializeAndCloseDispatchers(Channel* channel) { |
| 183 DCHECK(channel); | 184 DCHECK(channel); |
| 184 DCHECK(!transport_data_); | 185 DCHECK(!transport_data_); |
| 185 | 186 |
| 186 if (!dispatchers_ || !dispatchers_->size()) | 187 if (!dispatchers_ || !dispatchers_->size()) |
| 187 return; | 188 return; |
| 188 | 189 |
| 189 transport_data_.reset(new TransportData(dispatchers_.Pass(), channel)); | 190 transport_data_.reset(new TransportData(dispatchers_.Pass(), channel)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 213 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); | 214 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); |
| 214 header()->total_size = static_cast<uint32_t>(main_buffer_size_); | 215 header()->total_size = static_cast<uint32_t>(main_buffer_size_); |
| 215 if (transport_data_) { | 216 if (transport_data_) { |
| 216 header()->total_size += | 217 header()->total_size += |
| 217 static_cast<uint32_t>(transport_data_->buffer_size()); | 218 static_cast<uint32_t>(transport_data_->buffer_size()); |
| 218 } | 219 } |
| 219 } | 220 } |
| 220 | 221 |
| 221 } // namespace system | 222 } // namespace system |
| 222 } // namespace mojo | 223 } // namespace mojo |
| OLD | NEW |