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

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

Issue 1350503004: Some easy conversions of scoped_ptr -> std::unique_ptr in the EDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 months 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/raw_channel.h ('k') | mojo/edk/system/raw_channel_posix.cc » ('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 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/raw_channel.h" 5 #include "mojo/edk/system/raw_channel.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/location.h" 13 #include "base/location.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
15 #include "mojo/edk/system/message_in_transit.h" 16 #include "mojo/edk/system/message_in_transit.h"
16 #include "mojo/edk/system/transport_data.h" 17 #include "mojo/edk/system/transport_data.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 namespace system { 20 namespace system {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 211
211 // Reset the delegate so that it won't receive further calls. 212 // Reset the delegate so that it won't receive further calls.
212 delegate_ = nullptr; 213 delegate_ = nullptr;
213 if (set_on_shutdown_) { 214 if (set_on_shutdown_) {
214 *set_on_shutdown_ = true; 215 *set_on_shutdown_ = true;
215 set_on_shutdown_ = nullptr; 216 set_on_shutdown_ = nullptr;
216 } 217 }
217 write_stopped_ = true; 218 write_stopped_ = true;
218 weak_ptr_factory_.InvalidateWeakPtrs(); 219 weak_ptr_factory_.InvalidateWeakPtrs();
219 220
220 OnShutdownNoLock(read_buffer_.Pass(), write_buffer_.Pass()); 221 OnShutdownNoLock(std::move(read_buffer_), std::move(write_buffer_));
221 } 222 }
222 223
223 // Reminder: This must be thread-safe. 224 // Reminder: This must be thread-safe.
224 bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) { 225 bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
225 DCHECK(message); 226 DCHECK(message);
226 227
227 MutexLocker locker(&write_mutex_); 228 MutexLocker locker(&write_mutex_);
228 if (write_stopped_) 229 if (write_stopped_)
229 return false; 230 return false;
230 231
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 504
504 write_stopped_ = true; 505 write_stopped_ = true;
505 write_buffer_->message_queue_.Clear(); 506 write_buffer_->message_queue_.Clear();
506 write_buffer_->platform_handles_offset_ = 0; 507 write_buffer_->platform_handles_offset_ = 0;
507 write_buffer_->data_offset_ = 0; 508 write_buffer_->data_offset_ = 0;
508 return false; 509 return false;
509 } 510 }
510 511
511 } // namespace system 512 } // namespace system
512 } // namespace mojo 513 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/raw_channel.h ('k') | mojo/edk/system/raw_channel_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698