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

Unified Diff: content/browser/renderer_host/pepper_udp_socket.cc

Issue 9212047: Add GetBoundAddress to PPB_UDPSocket_Private (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: A few more changes via review Created 8 years, 10 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: content/browser/renderer_host/pepper_udp_socket.cc
diff --git a/content/browser/renderer_host/pepper_udp_socket.cc b/content/browser/renderer_host/pepper_udp_socket.cc
index 33f2c7f0c17199eef6e047f4680cc5ea250c975b..b6f8de39b548a825be1bb4df2eb76570a6ef3a1b 100644
--- a/content/browser/renderer_host/pepper_udp_socket.cc
+++ b/content/browser/renderer_host/pepper_udp_socket.cc
@@ -49,6 +49,11 @@ void PepperUDPSocket::Bind(const PP_NetAddress_Private& addr) {
int result = socket_->Listen(address);
+ // If we are successful, get the local address we bound to.
viettrungluu 2012/02/07 23:03:58 Nit: This comment is useless; it's self-evident fr
mtilburg1 2012/02/08 15:27:01 Done.
+ if (result == net::OK) {
viettrungluu 2012/02/07 23:03:58 Nit: Other single-line if statements in the file d
mtilburg1 2012/02/08 15:27:01 Done.
+ socket_->GetLocalAddress(&bound_address_);
+ }
+
SendBindACK(result == net::OK);
}
@@ -106,8 +111,12 @@ void PepperUDPSocket::SendSendToACKError() {
}
void PepperUDPSocket::SendBindACK(bool result) {
+ PP_NetAddress_Private addr = NetAddressPrivateImpl::kInvalidNetAddress;
+ if (!NetAddressPrivateImpl::IPEndPointToNetAddress(bound_address_, &addr))
viettrungluu 2012/02/07 23:03:58 Shouldn't you do some other cleanup here, rather t
mtilburg1 2012/02/08 15:27:01 Changed to be consistant with GetRecvFromACKError.
+ result = false;
+
manager_->Send(new PpapiMsg_PPBUDPSocket_BindACK(
- routing_id_, plugin_dispatcher_id_, socket_id_, result));
+ routing_id_, plugin_dispatcher_id_, socket_id_, result, addr));
}
void PepperUDPSocket::OnRecvFromCompleted(int result) {

Powered by Google App Engine
This is Rietveld 408576698