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

Unified Diff: mojo/services/network/udp_socket_impl.h

Issue 880613005: De-Clientize UDPSocket service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rollin
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/network/udp_socket_apptest.cc ('k') | mojo/services/network/udp_socket_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/network/udp_socket_impl.h
diff --git a/mojo/services/network/udp_socket_impl.h b/mojo/services/network/udp_socket_impl.h
index eb63d93d4e6973ea6d6925f482eacca3a7267d74..c2070bf54cf6edb5c58a80f6a3acdc3690f517bc 100644
--- a/mojo/services/network/udp_socket_impl.h
+++ b/mojo/services/network/udp_socket_impl.h
@@ -13,6 +13,7 @@
#include "net/base/ip_endpoint.h"
#include "net/udp/udp_socket.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
namespace net {
class IOBuffer;
@@ -21,22 +22,28 @@ class IOBufferWithSize;
namespace mojo {
-class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
+class UDPSocketImpl : public UDPSocket {
public:
- UDPSocketImpl();
+ // The lifetime of a new UDPSocketImpl is bound to the connection associated
+ // with |request|.
+ explicit UDPSocketImpl(InterfaceRequest<UDPSocket> request);
~UDPSocketImpl() override;
// UDPSocket implementation.
void AllowAddressReuse(
const Callback<void(NetworkErrorPtr)>& callback) override;
- void Bind(
- NetAddressPtr addr,
- const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) override;
+ void Bind(NetAddressPtr addr,
+ const Callback<void(NetworkErrorPtr,
+ NetAddressPtr,
+ InterfaceRequest<UDPSocketReceiver>)>& callback)
+ override;
- void Connect(
- NetAddressPtr remote_addr,
- const Callback<void(NetworkErrorPtr, NetAddressPtr)>& callback) override;
+ void Connect(NetAddressPtr remote_addr,
+ const Callback<void(NetworkErrorPtr,
+ NetAddressPtr,
+ InterfaceRequest<UDPSocketReceiver>)>&
+ callback) override;
void SetSendBufferSize(
uint32_t size,
@@ -85,6 +92,8 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
return state_ == BOUND || state_ == CONNECTED;
}
+ StrongBinding<UDPSocket> binding_;
+
net::UDPSocket socket_;
State state_;
@@ -96,8 +105,12 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
// Non-null when there is a pending SendTo operation on |socket_|.
scoped_refptr<net::IOBufferWithSize> sendto_buffer_;
+ // The address of the pending RecvFrom operation, if any.
net::IPEndPoint recvfrom_address_;
+ // The interface which gets data from fulfilled receive requests.
+ UDPSocketReceiverPtr receiver_;
+
// How many more packets the client side expects to receive.
size_t remaining_recv_slots_;
« no previous file with comments | « mojo/services/network/udp_socket_apptest.cc ('k') | mojo/services/network/udp_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698