Chromium Code Reviews| Index: mojo/services/network/public/interfaces/udp_socket.mojom |
| diff --git a/mojo/services/network/public/interfaces/udp_socket.mojom b/mojo/services/network/public/interfaces/udp_socket.mojom |
| index 0ea08a5af7f1a4663368f450d3d0e876d51b71d9..d003d1795463d7357909da016bd7c92fe0ddb5f9 100644 |
| --- a/mojo/services/network/public/interfaces/udp_socket.mojom |
| +++ b/mojo/services/network/public/interfaces/udp_socket.mojom |
| @@ -7,17 +7,15 @@ module mojo; |
| import "network/public/interfaces/net_address.mojom"; |
| import "network/public/interfaces/network_error.mojom"; |
| -// UDPSocket and UDPSocketClient represent a UDP socket and its client. The |
| +// UDPSocket and UDPSocketReceiver represent a UDP socket and its client. The |
| // typical flow of using the interfaces is: |
| -// - Acquire a UDPSocket interface pointer and set a UDPSocketClient instance. |
| +// - Acquire a UDPSocket interface pointer and set a UDPSocketReceiver instance |
| +// using SetReceiver(). |
| // - (optional) Set options which are allowed prior to Bind()/Connect(). |
| // - Bind or connect the socket. |
| // - (optional) Set options which are allowed after Bind()/Connect(). |
| // - Send / request to receive datagrams. Received datagrams will be delivered |
| -// to UDPSocketClient.OnReceived(). |
| - |
| -// TODO(yzshen): Get rid of [Client] annotation. |
| -[Client=UDPSocketClient] |
| +// to UDPSocketReceiver.OnReceived(). |
| interface UDPSocket { |
| // Allows the socket to share the local address to which it will be bound with |
| // other processes. Should be called before Bind(). |
| @@ -60,8 +58,14 @@ interface UDPSocket { |
| NegotiateMaxPendingSendRequests(uint32 requested_size) |
| => (uint32 actual_size); |
| - // Notifies that the client is ready to accept |number| of datagrams. |
| - // Correspondingly, OnReceived() of the UDPSocketClient interface will be |
| + // Sets the receiver interface. This can be set multiple times and may also |
| + // be set to null. Be aware that pending receive requests which occur between |
|
jamesr
2015/01/28 20:48:37
what does a null receiver mean?
|
| + // the time this is called and the time the receiver change actually happens |
| + // may be sent to the previous set receiver, if any. |
| + SetReceiver(UDPSocketReceiver? receiver); |
| + |
| + // Notifies that the receiver is ready to accept |number| of datagrams. |
| + // Correspondingly, OnReceived() of the UDPSocketReceiver interface will be |
| // called |number| times (errors also count), unless the connection is closed |
| // before that. |
| // |
| @@ -108,7 +112,7 @@ interface UDPSocket { |
| SendTo(NetAddress? dest_addr, array<uint8> data) => (NetworkError result); |
| }; |
| -interface UDPSocketClient { |
| +interface UDPSocketReceiver { |
| // On success, |data| is non-null, |src_addr| is non-null if the socket is |
| // not connected, |result.code| is a non-negative number indicating how many |
| // bytes have been received. On failure, |result.code| is a network error |