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

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

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 #ifndef MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_ 5 #ifndef MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_
6 #define MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_ 6 #define MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "mojo/application/app_lifetime_helper.h"
10 #include "mojo/common/handle_watcher.h" 11 #include "mojo/common/handle_watcher.h"
11 #include "mojo/services/network/public/interfaces/tcp_connected_socket.mojom.h" 12 #include "mojo/services/network/public/interfaces/tcp_connected_socket.mojom.h"
12 #include "net/socket/tcp_socket.h" 13 #include "net/socket/tcp_socket.h"
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
14 15
15 namespace mojo { 16 namespace mojo {
16 17
17 class MojoToNetPendingBuffer; 18 class MojoToNetPendingBuffer;
18 class NetToMojoPendingBuffer; 19 class NetToMojoPendingBuffer;
19 20
20 class TCPConnectedSocketImpl : public TCPConnectedSocket, public ErrorHandler { 21 class TCPConnectedSocketImpl : public TCPConnectedSocket, public ErrorHandler {
21 public: 22 public:
22 TCPConnectedSocketImpl(scoped_ptr<net::TCPSocket> socket, 23 TCPConnectedSocketImpl(scoped_ptr<net::TCPSocket> socket,
23 ScopedDataPipeConsumerHandle send_stream, 24 ScopedDataPipeConsumerHandle send_stream,
24 ScopedDataPipeProducerHandle receive_stream, 25 ScopedDataPipeProducerHandle receive_stream,
25 InterfaceRequest<TCPConnectedSocket> request); 26 InterfaceRequest<TCPConnectedSocket> request,
27 scoped_ptr<mojo::AppRefCount> app_refcount);
26 ~TCPConnectedSocketImpl() override; 28 ~TCPConnectedSocketImpl() override;
27 29
28 private: 30 private:
29 // ErrorHandler methods: 31 // ErrorHandler methods:
30 void OnConnectionError() override; 32 void OnConnectionError() override;
31 33
32 // "Receiving" in this context means reading from TCPSocket and writing to 34 // "Receiving" in this context means reading from TCPSocket and writing to
33 // the Mojo receive_stream. 35 // the Mojo receive_stream.
34 void ReceiveMore(); 36 void ReceiveMore();
35 void OnReceiveStreamReady(MojoResult result); 37 void OnReceiveStreamReady(MojoResult result);
(...skipping 25 matching lines...) Expand all
61 common::HandleWatcher receive_handle_watcher_; 63 common::HandleWatcher receive_handle_watcher_;
62 64
63 // For reading from the Mojo pipe and writing to the network. 65 // For reading from the Mojo pipe and writing to the network.
64 ScopedDataPipeProducerHandle receive_stream_; 66 ScopedDataPipeProducerHandle receive_stream_;
65 scoped_refptr<MojoToNetPendingBuffer> pending_send_; 67 scoped_refptr<MojoToNetPendingBuffer> pending_send_;
66 common::HandleWatcher send_handle_watcher_; 68 common::HandleWatcher send_handle_watcher_;
67 69
68 // To bind to the message pipe. 70 // To bind to the message pipe.
69 Binding<TCPConnectedSocket> binding_; 71 Binding<TCPConnectedSocket> binding_;
70 72
73 scoped_ptr<mojo::AppRefCount> app_refcount_;
74
71 base::WeakPtrFactory<TCPConnectedSocketImpl> weak_ptr_factory_; 75 base::WeakPtrFactory<TCPConnectedSocketImpl> weak_ptr_factory_;
72 }; 76 };
73 77
74 } // namespace mojo 78 } // namespace mojo
75 79
76 #endif // MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_ 80 #endif // MOJO_SERVICES_NETWORK_TCP_CONNECTED_SOCKET_H_
OLDNEW
« no previous file with comments | « mojo/services/network/tcp_bound_socket_impl.cc ('k') | mojo/services/network/tcp_connected_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698