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

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

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 #ifndef MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_ 5 #ifndef MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_
6 #define MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_ 6 #define MOJO_SERVICES_NETWORK_TCP_BOUND_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_bound_socket.mojom.h" 9 #include "mojo/services/network/public/interfaces/tcp_bound_socket.mojom.h"
10 #include "net/socket/tcp_socket.h" 10 #include "net/socket/tcp_socket.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h" 11 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 class TCPBoundSocketImpl : public InterfaceImpl<TCPBoundSocket> { 15 class TCPBoundSocketImpl : public TCPBoundSocket {
16 public: 16 public:
17 TCPBoundSocketImpl(); 17 explicit TCPBoundSocketImpl(InterfaceRequest<TCPBoundSocket> request);
18 ~TCPBoundSocketImpl() override; 18 ~TCPBoundSocketImpl() override;
19 19
20 // Does the actual binding. Returns a net error code. On net::OK, the bound 20 // Does the actual binding. Returns a net error code. On net::OK, the bound
21 // socket will be ready to use and send back to the client. On failure, this 21 // socket will be ready to use and send back to the client. On failure, this
22 // object should be destroyed and no longer used. 22 // object should be destroyed and no longer used.
23 int Bind(NetAddressPtr local_address); 23 int Bind(NetAddressPtr local_address);
24 24
25 // Returns the local address associated with this socket. This should only 25 // Returns the local address associated with this socket. This should only
26 // be called after Bind has succeeded. 26 // be called after Bind has succeeded.
27 NetAddressPtr GetLocalAddress() const; 27 NetAddressPtr GetLocalAddress() const;
28 28
29 // TCPBoundSocket. 29 // TCPBoundSocket.
30 void StartListening(InterfaceRequest<TCPServerSocket> server, 30 void StartListening(InterfaceRequest<TCPServerSocket> server,
31 const Callback<void(NetworkErrorPtr)>& callback) override; 31 const Callback<void(NetworkErrorPtr)>& callback) override;
32 void Connect(NetAddressPtr remote_address, 32 void Connect(NetAddressPtr remote_address,
33 ScopedDataPipeConsumerHandle send_stream, 33 ScopedDataPipeConsumerHandle send_stream,
34 ScopedDataPipeProducerHandle receive_stream, 34 ScopedDataPipeProducerHandle receive_stream,
35 InterfaceRequest<TCPConnectedSocket> client_socket, 35 InterfaceRequest<TCPConnectedSocket> client_socket,
36 const Callback<void(NetworkErrorPtr)>& callback) override; 36 const Callback<void(NetworkErrorPtr)>& callback) override;
37 37
38 private: 38 private:
39 void OnConnected(int result); 39 void OnConnected(int result);
40 40
41 StrongBinding<TCPBoundSocket> binding_;
41 scoped_ptr<net::TCPSocket> socket_; 42 scoped_ptr<net::TCPSocket> socket_;
42 43
43 // Valid when waiting for a connect callback. 44 // Valid when waiting for a connect callback.
44 ScopedDataPipeConsumerHandle pending_connect_send_stream_; 45 ScopedDataPipeConsumerHandle pending_connect_send_stream_;
45 ScopedDataPipeProducerHandle pending_connect_receive_stream_; 46 ScopedDataPipeProducerHandle pending_connect_receive_stream_;
46 InterfaceRequest<TCPConnectedSocket> pending_connect_socket_; 47 InterfaceRequest<TCPConnectedSocket> pending_connect_socket_;
47 Callback<void(NetworkErrorPtr)> pending_connect_callback_; 48 Callback<void(NetworkErrorPtr)> pending_connect_callback_;
48 }; 49 };
49 50
50 } // namespace mojo 51 } // namespace mojo
51 52
52 #endif // MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_ 53 #endif // MOJO_SERVICES_NETWORK_TCP_BOUND_SOCKET_H_
OLDNEW
« no previous file with comments | « mojo/services/network/network_service_impl.cc ('k') | mojo/services/network/tcp_bound_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698