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

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

Issue 1227373002: Roll mojo SDK to 734c6e1652ff2f3b696e441722838f453f4f9b42 (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: 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 #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/services/network/public/interfaces/tcp_server_socket.mojom.h" 9 #include "mojo/services/network/public/interfaces/tcp_server_socket.mojom.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
11 #include "net/socket/tcp_socket.h" 11 #include "net/socket/tcp_socket.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 15
16 class TCPServerSocketImpl : public InterfaceImpl<TCPServerSocket> { 16 class TCPServerSocketImpl : public TCPServerSocket {
17 public: 17 public:
18 typedef Callback<void(NetworkErrorPtr, NetAddressPtr)> AcceptCallback; 18 typedef Callback<void(NetworkErrorPtr, NetAddressPtr)> AcceptCallback;
19 19
20 // Passed ownership of a socket already in listening mode. 20 // Passed ownership of a socket already in listening mode.
21 explicit TCPServerSocketImpl(scoped_ptr<net::TCPSocket> socket); 21 TCPServerSocketImpl(InterfaceRequest<TCPServerSocket> request,
22 scoped_ptr<net::TCPSocket> socket);
22 ~TCPServerSocketImpl() override; 23 ~TCPServerSocketImpl() override;
23 24
24 // TCPServerSocket. 25 // TCPServerSocket.
25 void Accept(ScopedDataPipeConsumerHandle send_stream, 26 void Accept(ScopedDataPipeConsumerHandle send_stream,
26 ScopedDataPipeProducerHandle receive_stream, 27 ScopedDataPipeProducerHandle receive_stream,
27 InterfaceRequest<TCPConnectedSocket> client_socket, 28 InterfaceRequest<TCPConnectedSocket> client_socket,
28 const AcceptCallback& callback) override; 29 const AcceptCallback& callback) override;
29 30
30 private: 31 private:
31 void OnAcceptCompleted(int result); 32 void OnAcceptCompleted(int result);
32 33
33 scoped_ptr<net::TCPSocket> socket_; 34 scoped_ptr<net::TCPSocket> socket_;
34 35
35 // Non-null when accept is pending. 36 // Non-null when accept is pending.
36 AcceptCallback pending_callback_; 37 AcceptCallback pending_callback_;
37 38
38 // The parameters associated with the pending Accept call. 39 // The parameters associated with the pending Accept call.
39 ScopedDataPipeConsumerHandle pending_send_stream_; 40 ScopedDataPipeConsumerHandle pending_send_stream_;
40 ScopedDataPipeProducerHandle pending_receive_stream_; 41 ScopedDataPipeProducerHandle pending_receive_stream_;
41 InterfaceRequest<TCPConnectedSocket> pending_client_socket_; 42 InterfaceRequest<TCPConnectedSocket> pending_client_socket_;
42 43
43 // These are written to by net::TCPSocket when Accept is completed. 44 // These are written to by net::TCPSocket when Accept is completed.
44 scoped_ptr<net::TCPSocket> accepted_socket_; 45 scoped_ptr<net::TCPSocket> accepted_socket_;
45 net::IPEndPoint accepted_address_; 46 net::IPEndPoint accepted_address_;
47
48 StrongBinding<TCPServerSocket> binding_;
46 }; 49 };
47 50
48 } // namespace mojo 51 } // namespace mojo
49 52
50 #endif // MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_ 53 #endif // MOJO_SERVICES_NETWORK_TCP_SERVER_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698