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

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

Issue 1353683005: EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system. (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/proxy_message_pipe_endpoint.h ('k') | mojo/edk/system/raw_channel.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/proxy_message_pipe_endpoint.h" 5 #include "mojo/edk/system/proxy_message_pipe_endpoint.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility>
10
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "mojo/edk/system/channel_endpoint.h" 12 #include "mojo/edk/system/channel_endpoint.h"
11 #include "mojo/edk/system/local_message_pipe_endpoint.h" 13 #include "mojo/edk/system/local_message_pipe_endpoint.h"
12 #include "mojo/edk/system/message_pipe_dispatcher.h" 14 #include "mojo/edk/system/message_pipe_dispatcher.h"
13 15
14 namespace mojo { 16 namespace mojo {
15 namespace system { 17 namespace system {
16 18
17 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint( 19 ProxyMessagePipeEndpoint::ProxyMessagePipeEndpoint(
18 ChannelEndpoint* channel_endpoint) 20 ChannelEndpoint* channel_endpoint)
(...skipping 18 matching lines...) Expand all
37 39
38 bool ProxyMessagePipeEndpoint::OnPeerClose() { 40 bool ProxyMessagePipeEndpoint::OnPeerClose() {
39 DetachIfNecessary(); 41 DetachIfNecessary();
40 return false; 42 return false;
41 } 43 }
42 44
43 // Note: We may have to enqueue messages even when our (local) peer isn't open 45 // Note: We may have to enqueue messages even when our (local) peer isn't open
44 // -- it may have been written to and closed immediately, before we were ready. 46 // -- it may have been written to and closed immediately, before we were ready.
45 // This case is handled in |Run()| (which will call us). 47 // This case is handled in |Run()| (which will call us).
46 void ProxyMessagePipeEndpoint::EnqueueMessage( 48 void ProxyMessagePipeEndpoint::EnqueueMessage(
47 scoped_ptr<MessageInTransit> message) { 49 std::unique_ptr<MessageInTransit> message) {
48 DCHECK(channel_endpoint_); 50 DCHECK(channel_endpoint_);
49 bool ok = channel_endpoint_->EnqueueMessage(message.Pass()); 51 bool ok = channel_endpoint_->EnqueueMessage(std::move(message));
50 LOG_IF(WARNING, !ok) << "Failed to write enqueue message to channel"; 52 LOG_IF(WARNING, !ok) << "Failed to write enqueue message to channel";
51 } 53 }
52 54
53 void ProxyMessagePipeEndpoint::Close() { 55 void ProxyMessagePipeEndpoint::Close() {
54 DetachIfNecessary(); 56 DetachIfNecessary();
55 } 57 }
56 58
57 void ProxyMessagePipeEndpoint::DetachIfNecessary() { 59 void ProxyMessagePipeEndpoint::DetachIfNecessary() {
58 if (channel_endpoint_) { 60 if (channel_endpoint_) {
59 channel_endpoint_->DetachFromClient(); 61 channel_endpoint_->DetachFromClient();
60 channel_endpoint_ = nullptr; 62 channel_endpoint_ = nullptr;
61 } 63 }
62 } 64 }
63 65
64 } // namespace system 66 } // namespace system
65 } // namespace mojo 67 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/proxy_message_pipe_endpoint.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698