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

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

Issue 1227373002: Roll mojo SDK to 734c6e1652ff2f3b696e441722838f453f4f9b42 (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Follow review Created 5 years, 5 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 : socket_(socket.Pass()), 18 : socket_(socket.Pass()),
19 send_stream_(send_stream.Pass()), 19 send_stream_(send_stream.Pass()),
20 receive_stream_(receive_stream.Pass()), 20 receive_stream_(receive_stream.Pass()),
21 binding_(this, request.Pass()), 21 binding_(this, request.Pass()),
22 send_more_posted_(false), 22 send_more_posted_(false),
23 weak_ptr_factory_(this) { 23 weak_ptr_factory_(this) {
24 // Queue up async communication. 24 // Queue up async communication.
25 binding_.set_error_handler(this); 25 binding_.set_connection_error_handler([this]() { OnConnectionError(); });
26 ListenForReceivePeerClosed(); 26 ListenForReceivePeerClosed();
27 ListenForSendPeerClosed(); 27 ListenForSendPeerClosed();
28 ReceiveMore(); 28 ReceiveMore();
29 SendMore(); 29 SendMore();
30 } 30 }
31 31
32 TCPConnectedSocketImpl::~TCPConnectedSocketImpl() { 32 TCPConnectedSocketImpl::~TCPConnectedSocketImpl() {
33 } 33 }
34 34
35 void TCPConnectedSocketImpl::OnConnectionError() { 35 void TCPConnectedSocketImpl::OnConnectionError() {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 256 }
257 257
258 void TCPConnectedSocketImpl::DeleteIfNeeded() { 258 void TCPConnectedSocketImpl::DeleteIfNeeded() {
259 bool has_send = pending_send_ || send_stream_.is_valid(); 259 bool has_send = pending_send_ || send_stream_.is_valid();
260 bool has_receive = pending_receive_ || receive_stream_.is_valid(); 260 bool has_receive = pending_receive_ || receive_stream_.is_valid();
261 if (!binding_.is_bound() && !has_send && !has_receive) 261 if (!binding_.is_bound() && !has_send && !has_receive)
262 delete this; 262 delete this;
263 } 263 }
264 264
265 } // namespace mojo 265 } // 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