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

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
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..4e8188369e45c5dbfac505bff0617059ec77e185 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,9 +22,11 @@ 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.
@@ -50,6 +53,8 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
uint32_t requested_size,
const Callback<void(uint32_t)>& callback) override;
+ void SetReceiver(UDPSocketReceiverPtr receiver) override;
+
void ReceiveMore(uint32_t datagram_number) override;
void SendTo(NetAddressPtr dest_addr,
@@ -85,6 +90,8 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
return state_ == BOUND || state_ == CONNECTED;
}
+ StrongBinding<UDPSocket> binding_;
+
net::UDPSocket socket_;
State state_;
@@ -96,8 +103,15 @@ 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 result code the pending RecvFrom operation, if any.
+ int recvfrom_result_;
+
+ // 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_;

Powered by Google App Engine
This is Rietveld 408576698