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

Side by Side Diff: mojo/services/network/tcp_connected_socket_impl.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
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/services/network/tcp_connected_socket_impl.h" 5 #include "mojo/services/network/tcp_connected_socket_impl.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "mojo/services/network/net_adapters.h" 8 #include "mojo/services/network/net_adapters.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 TCPConnectedSocketImpl::TCPConnectedSocketImpl( 13 TCPConnectedSocketImpl::TCPConnectedSocketImpl(
14 scoped_ptr<net::TCPSocket> socket, 14 scoped_ptr<net::TCPSocket> socket,
15 ScopedDataPipeConsumerHandle send_stream, 15 ScopedDataPipeConsumerHandle send_stream,
16 ScopedDataPipeProducerHandle receive_stream, 16 ScopedDataPipeProducerHandle receive_stream,
17 InterfaceRequest<TCPConnectedSocket> request) 17 InterfaceRequest<TCPConnectedSocket> request,
18 scoped_ptr<mojo::AppRefCount> app_refcount)
18 : socket_(socket.Pass()), 19 : socket_(socket.Pass()),
19 send_stream_(send_stream.Pass()), 20 send_stream_(send_stream.Pass()),
20 receive_stream_(receive_stream.Pass()), 21 receive_stream_(receive_stream.Pass()),
21 binding_(this, request.Pass()), 22 binding_(this, request.Pass()),
23 app_refcount_(app_refcount.Pass()),
22 weak_ptr_factory_(this) { 24 weak_ptr_factory_(this) {
23 // Queue up async communication. 25 // Queue up async communication.
24 binding_.set_error_handler(this); 26 binding_.set_error_handler(this);
25 ListenForReceivePeerClosed(); 27 ListenForReceivePeerClosed();
26 ListenForSendPeerClosed(); 28 ListenForSendPeerClosed();
27 ReceiveMore(); 29 ReceiveMore();
28 SendMore(); 30 SendMore();
29 } 31 }
30 32
31 TCPConnectedSocketImpl::~TCPConnectedSocketImpl() { 33 TCPConnectedSocketImpl::~TCPConnectedSocketImpl() {
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 247 }
246 248
247 void TCPConnectedSocketImpl::DeleteIfNeeded() { 249 void TCPConnectedSocketImpl::DeleteIfNeeded() {
248 bool has_send = pending_send_ || send_stream_.is_valid(); 250 bool has_send = pending_send_ || send_stream_.is_valid();
249 bool has_receive = pending_receive_ || receive_stream_.is_valid(); 251 bool has_receive = pending_receive_ || receive_stream_.is_valid();
250 if (!binding_.is_bound() && !has_send && !has_receive) 252 if (!binding_.is_bound() && !has_send && !has_receive)
251 delete this; 253 delete this;
252 } 254 }
253 255
254 } // namespace mojo 256 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/tcp_connected_socket_impl.h ('k') | mojo/services/network/tcp_server_socket_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698