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

Side by Side Diff: mojo/services/network/tcp_server_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_SERVER_SOCKET_H_ 5 #ifndef MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_
6 #define MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_ 6 #define MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/application/app_lifetime_helper.h"
9 #include "mojo/services/network/public/interfaces/tcp_server_socket.mojom.h" 10 #include "mojo/services/network/public/interfaces/tcp_server_socket.mojom.h"
10 #include "net/base/ip_endpoint.h" 11 #include "net/base/ip_endpoint.h"
11 #include "net/socket/tcp_socket.h" 12 #include "net/socket/tcp_socket.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 class TCPServerSocketImpl : public InterfaceImpl<TCPServerSocket> { 17 class TCPServerSocketImpl : public InterfaceImpl<TCPServerSocket> {
17 public: 18 public:
18 typedef Callback<void(NetworkErrorPtr, NetAddressPtr)> AcceptCallback; 19 typedef Callback<void(NetworkErrorPtr, NetAddressPtr)> AcceptCallback;
19 20
20 // Passed ownership of a socket already in listening mode. 21 // Passed ownership of a socket already in listening mode.
21 explicit TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket); 22 TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket,
23 scoped_ptr<mojo::AppRefCount> app_refcount);
22 ~TCPServerSocketImpl() override; 24 ~TCPServerSocketImpl() override;
23 25
24 // TCPServerSocket. 26 // TCPServerSocket.
25 void Accept(ScopedDataPipeConsumerHandle send_stream, 27 void Accept(ScopedDataPipeConsumerHandle send_stream,
26 ScopedDataPipeProducerHandle receive_stream, 28 ScopedDataPipeProducerHandle receive_stream,
27 InterfaceRequest<TCPConnectedSocket> client_socket, 29 InterfaceRequest<TCPConnectedSocket> client_socket,
28 const AcceptCallback& callback) override; 30 const AcceptCallback& callback) override;
29 31
30 private: 32 private:
31 void OnAcceptCompleted(int result); 33 void OnAcceptCompleted(int result);
32 34
33 scoped_ptr<net::TCPSocket> socket_; 35 scoped_ptr<net::TCPSocket> socket_;
34 36
35 // Non-null when accept is pending. 37 // Non-null when accept is pending.
36 AcceptCallback pending_callback_; 38 AcceptCallback pending_callback_;
37 39
38 // The parameters associated with the pending Accept call. 40 // The parameters associated with the pending Accept call.
39 ScopedDataPipeConsumerHandle pending_send_stream_; 41 ScopedDataPipeConsumerHandle pending_send_stream_;
40 ScopedDataPipeProducerHandle pending_receive_stream_; 42 ScopedDataPipeProducerHandle pending_receive_stream_;
41 InterfaceRequest<TCPConnectedSocket> pending_client_socket_; 43 InterfaceRequest<TCPConnectedSocket> pending_client_socket_;
42 44
43 // These are written to by net::TCPSocket when Accept is completed. 45 // These are written to by net::TCPSocket when Accept is completed.
44 scoped_ptr<net::TCPSocket> accepted_socket_; 46 scoped_ptr<net::TCPSocket> accepted_socket_;
45 net::IPEndPoint accepted_address_; 47 net::IPEndPoint accepted_address_;
48
49 scoped_ptr<mojo::AppRefCount> app_refcount_;
46 }; 50 };
47 51
48 } // namespace mojo 52 } // namespace mojo
49 53
50 #endif // MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_ 54 #endif // MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_
OLDNEW
« no previous file with comments | « mojo/services/network/tcp_connected_socket_impl.cc ('k') | mojo/services/network/tcp_server_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698