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/system/message_in_transit.h" | 5 #include "mojo/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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if (buffer_size < sizeof(Header)) | 144 if (buffer_size < sizeof(Header)) |
145 return false; | 145 return false; |
146 | 146 |
147 const Header* header = static_cast<const Header*>(buffer); | 147 const Header* header = static_cast<const Header*>(buffer); |
148 *next_message_size = header->total_size; | 148 *next_message_size = header->total_size; |
149 DCHECK_EQ(*next_message_size % kMessageAlignment, 0u); | 149 DCHECK_EQ(*next_message_size % kMessageAlignment, 0u); |
150 return true; | 150 return true; |
151 } | 151 } |
152 | 152 |
153 void MessageInTransit::SetDispatchers( | 153 void MessageInTransit::SetDispatchers( |
154 scoped_ptr<std::vector<scoped_refptr<Dispatcher> > > dispatchers) { | 154 scoped_ptr<DispatcherVector> dispatchers) { |
155 DCHECK(dispatchers); | 155 DCHECK(dispatchers); |
156 DCHECK(!dispatchers_); | 156 DCHECK(!dispatchers_); |
157 | 157 |
158 dispatchers_ = dispatchers.Pass(); | 158 dispatchers_ = dispatchers.Pass(); |
159 #ifndef NDEBUG | 159 #ifndef NDEBUG |
160 for (size_t i = 0; i < dispatchers_->size(); i++) | 160 for (size_t i = 0; i < dispatchers_->size(); i++) |
161 DCHECK(!(*dispatchers_)[i] || (*dispatchers_)[i]->HasOneRef()); | 161 DCHECK(!(*dispatchers_)[i] || (*dispatchers_)[i]->HasOneRef()); |
162 #endif | 162 #endif |
163 } | 163 } |
164 | 164 |
(...skipping 14 matching lines...) Expand all Loading... |
179 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); | 179 DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u); |
180 header()->total_size = static_cast<uint32_t>(main_buffer_size_); | 180 header()->total_size = static_cast<uint32_t>(main_buffer_size_); |
181 if (transport_data_) { | 181 if (transport_data_) { |
182 header()->total_size += | 182 header()->total_size += |
183 static_cast<uint32_t>(transport_data_->buffer_size()); | 183 static_cast<uint32_t>(transport_data_->buffer_size()); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 } // namespace system | 187 } // namespace system |
188 } // namespace mojo | 188 } // namespace mojo |
OLD | NEW |