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/system/raw_channel.h" | 5 #include "mojo/system/raw_channel.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 weak_ptr_factory_.InvalidateWeakPtrs(); | 143 weak_ptr_factory_.InvalidateWeakPtrs(); |
144 | 144 |
145 read_stopped_ = true; | 145 read_stopped_ = true; |
146 write_stopped_ = true; | 146 write_stopped_ = true; |
147 | 147 |
148 OnShutdownNoLock(read_buffer_.Pass(), write_buffer_.Pass()); | 148 OnShutdownNoLock(read_buffer_.Pass(), write_buffer_.Pass()); |
149 } | 149 } |
150 | 150 |
151 // Reminder: This must be thread-safe. | 151 // Reminder: This must be thread-safe. |
152 bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) { | 152 bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) { |
| 153 DCHECK(message); |
| 154 |
| 155 // TODO(vtl) |
| 156 if (message->has_platform_handles()) { |
| 157 NOTIMPLEMENTED(); |
| 158 return false; |
| 159 } |
| 160 |
153 base::AutoLock locker(write_lock_); | 161 base::AutoLock locker(write_lock_); |
154 if (write_stopped_) | 162 if (write_stopped_) |
155 return false; | 163 return false; |
156 | 164 |
157 if (!write_buffer_->message_queue_.empty()) { | 165 if (!write_buffer_->message_queue_.empty()) { |
158 write_buffer_->message_queue_.push_back(message.release()); | 166 write_buffer_->message_queue_.push_back(message.release()); |
159 return true; | 167 return true; |
160 } | 168 } |
161 | 169 |
162 write_buffer_->message_queue_.push_front(message.release()); | 170 write_buffer_->message_queue_.push_front(message.release()); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 358 } |
351 | 359 |
352 write_stopped_ = true; | 360 write_stopped_ = true; |
353 STLDeleteElements(&write_buffer_->message_queue_); | 361 STLDeleteElements(&write_buffer_->message_queue_); |
354 write_buffer_->offset_ = 0; | 362 write_buffer_->offset_ = 0; |
355 return false; | 363 return false; |
356 } | 364 } |
357 | 365 |
358 } // namespace system | 366 } // namespace system |
359 } // namespace mojo | 367 } // namespace mojo |
OLD | NEW |