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

Unified Diff: ppapi/shared_impl/private/udp_socket_private_impl.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: ppapi/shared_impl/private/udp_socket_private_impl.cc
diff --git a/ppapi/shared_impl/private/udp_socket_private_impl.cc b/ppapi/shared_impl/private/udp_socket_private_impl.cc
index 23f125d0acf1fca4445284ef33bf72078e7cd2bf..40176aff9e812d488525b78f7bc113c0109aac98 100644
--- a/ppapi/shared_impl/private/udp_socket_private_impl.cc
+++ b/ppapi/shared_impl/private/udp_socket_private_impl.cc
@@ -58,6 +58,14 @@ int32_t UDPSocketPrivateImpl::Bind(const PP_NetAddress_Private* addr,
return PP_OK_COMPLETIONPENDING;
}
+PP_Bool UDPSocketPrivateImpl::GetBoundAddress(PP_NetAddress_Private* addr) {
+ if (!addr)
+ return PP_FALSE;
+
+ *addr = bound_addr_;
viettrungluu 2012/02/07 23:03:58 This doesn't actually satisfy the contract given i
mtilburg1 2012/02/08 15:27:01 Done.
+ return PP_TRUE;
+}
+
int32_t UDPSocketPrivateImpl::RecvFrom(char* buffer,
int32_t num_bytes,
PP_CompletionCallback callback) {
@@ -122,7 +130,9 @@ void UDPSocketPrivateImpl::Close() {
PostAbortIfNecessary(&sendto_callback_);
}
-void UDPSocketPrivateImpl::OnBindCompleted(bool succeeded) {
+void UDPSocketPrivateImpl::OnBindCompleted(
+ bool succeeded,
+ const PP_NetAddress_Private& addr) {
if (!TrackedCallback::IsPending(bind_callback_)) {
NOTREACHED();
return;
@@ -131,8 +141,10 @@ void UDPSocketPrivateImpl::OnBindCompleted(bool succeeded) {
if (succeeded)
bound_ = true;
+ bound_addr_ = addr;
+
TrackedCallback::ClearAndRun(&bind_callback_,
- succeeded ? PP_OK : PP_ERROR_FAILED);
+ succeeded ? PP_OK : PP_ERROR_FAILED);
}
void UDPSocketPrivateImpl::OnRecvFromCompleted(
@@ -180,6 +192,9 @@ void UDPSocketPrivateImpl::Init(uint32 socket_id) {
recvfrom_addr_.size = 0;
memset(recvfrom_addr_.data, 0,
arraysize(recvfrom_addr_.data) * sizeof(*recvfrom_addr_.data));
+ bound_addr_.size = 0;
+ memset(bound_addr_.data, 0,
+ arraysize(bound_addr_.data) * sizeof(*bound_addr_.data));
}
void UDPSocketPrivateImpl::PostAbortIfNecessary(

Powered by Google App Engine
This is Rietveld 408576698