OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/udp_socket_private_resource.h" | 5 #include "ppapi/proxy/udp_socket_private_resource.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/ppb_udp_socket.h" | 8 #include "ppapi/c/ppb_udp_socket.h" |
9 #include "ppapi/shared_impl/tracked_callback.h" | 9 #include "ppapi/shared_impl/tracked_callback.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 break; | 34 break; |
35 case PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST: | 35 case PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST: |
36 public_name = PP_UDPSOCKET_OPTION_BROADCAST; | 36 public_name = PP_UDPSOCKET_OPTION_BROADCAST; |
37 break; | 37 break; |
38 case PP_UDPSOCKETFEATURE_PRIVATE_COUNT: | 38 case PP_UDPSOCKETFEATURE_PRIVATE_COUNT: |
39 return PP_ERROR_BADARGUMENT; | 39 return PP_ERROR_BADARGUMENT; |
40 default: | 40 default: |
41 NOTREACHED(); | 41 NOTREACHED(); |
42 return PP_ERROR_BADARGUMENT; | 42 return PP_ERROR_BADARGUMENT; |
43 } | 43 } |
44 int32_t result = SetOptionImpl(public_name, value, NULL); | 44 int32_t result = SetOptionImpl(public_name, value, |
| 45 true, // Check bind() state. |
| 46 NULL); |
45 return result == PP_OK_COMPLETIONPENDING ? PP_OK : result; | 47 return result == PP_OK_COMPLETIONPENDING ? PP_OK : result; |
46 } | 48 } |
47 | 49 |
48 int32_t UDPSocketPrivateResource::Bind( | 50 int32_t UDPSocketPrivateResource::Bind( |
49 const PP_NetAddress_Private* addr, | 51 const PP_NetAddress_Private* addr, |
50 scoped_refptr<TrackedCallback> callback) { | 52 scoped_refptr<TrackedCallback> callback) { |
51 return BindImpl(addr, callback); | 53 return BindImpl(addr, callback); |
52 } | 54 } |
53 | 55 |
54 PP_Bool UDPSocketPrivateResource::GetBoundAddress(PP_NetAddress_Private* addr) { | 56 PP_Bool UDPSocketPrivateResource::GetBoundAddress(PP_NetAddress_Private* addr) { |
(...skipping 19 matching lines...) Expand all Loading... |
74 scoped_refptr<TrackedCallback> callback) { | 76 scoped_refptr<TrackedCallback> callback) { |
75 return SendToImpl(buffer, num_bytes, addr, callback); | 77 return SendToImpl(buffer, num_bytes, addr, callback); |
76 } | 78 } |
77 | 79 |
78 void UDPSocketPrivateResource::Close() { | 80 void UDPSocketPrivateResource::Close() { |
79 CloseImpl(); | 81 CloseImpl(); |
80 } | 82 } |
81 | 83 |
82 } // namespace proxy | 84 } // namespace proxy |
83 } // namespace ppapi | 85 } // namespace ppapi |
OLD | NEW |