Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: mojo/edk/system/message_in_transit.cc

Issue 1488853002: Add multiplexing of message pipes in the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez review comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/message_in_transit.h ('k') | mojo/edk/system/message_pipe_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <ostream> 9 #include <ostream>
10 10
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void MessageInTransit::ConstructorHelper(Type type, 161 void MessageInTransit::ConstructorHelper(Type type,
162 uint32_t num_bytes) { 162 uint32_t num_bytes) {
163 DCHECK_LE(num_bytes, GetConfiguration().max_message_num_bytes); 163 DCHECK_LE(num_bytes, GetConfiguration().max_message_num_bytes);
164 164
165 // |total_size| is updated below, from the other values. 165 // |total_size| is updated below, from the other values.
166 header()->type = type; 166 header()->type = type;
167 header()->num_bytes = num_bytes; 167 header()->num_bytes = num_bytes;
168 header()->unused = 0; 168 header()->unused = 0;
169 header()->route_id = 0;
169 // Note: If dispatchers are subsequently attached, then |total_size| will have 170 // Note: If dispatchers are subsequently attached, then |total_size| will have
170 // to be adjusted. 171 // to be adjusted.
171 UpdateTotalSize(); 172 UpdateTotalSize();
172 } 173 }
173 174
174 void MessageInTransit::UpdateTotalSize() { 175 void MessageInTransit::UpdateTotalSize() {
175 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); 176 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u);
176 header()->total_size = static_cast<uint32_t>(main_buffer_size_); 177 header()->total_size = static_cast<uint32_t>(main_buffer_size_);
177 if (transport_data_) { 178 if (transport_data_) {
178 header()->total_size += 179 header()->total_size +=
179 static_cast<uint32_t>(transport_data_->buffer_size()); 180 static_cast<uint32_t>(transport_data_->buffer_size());
180 } 181 }
181 } 182 }
182 183
183 } // namespace edk 184 } // namespace edk
184 } // namespace mojo 185 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_in_transit.h ('k') | mojo/edk/system/message_pipe_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698