OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_resource.h" | 5 #include "ppapi/proxy/udp_socket_resource.h" |
6 | 6 |
7 #include "ppapi/shared_impl/tracked_callback.h" | 7 #include "ppapi/shared_impl/tracked_callback.h" |
8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
9 #include "ppapi/thunk/ppb_net_address_api.h" | 9 #include "ppapi/thunk/ppb_net_address_api.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 callback); | 71 callback); |
72 } | 72 } |
73 | 73 |
74 void UDPSocketResource::Close() { | 74 void UDPSocketResource::Close() { |
75 CloseImpl(); | 75 CloseImpl(); |
76 } | 76 } |
77 | 77 |
78 int32_t UDPSocketResource::SetOption1_0( | 78 int32_t UDPSocketResource::SetOption1_0( |
79 PP_UDPSocket_Option name, | 79 PP_UDPSocket_Option name, |
80 const PP_Var& value, | 80 const PP_Var& value, |
81 scoped_refptr<TrackedCallback> callback) { | 81 scoped_refptr<TrackedCallback> callback) { |
bbudge
2015/02/13 00:03:16
Check name parameter here too:
if (name > PP_UDP
etrunko
2015/02/13 20:19:58
Done.
| |
82 return SetOptionImpl(name, value, | 82 return SetOptionImpl(name, value, |
83 true, // Check bind() state. | 83 true, // Check bind() state. |
84 callback); | 84 callback); |
85 } | 85 } |
86 | 86 |
87 int32_t UDPSocketResource::SetOption1_1( | |
88 PP_UDPSocket_Option name, | |
89 const PP_Var& value, | |
90 scoped_refptr<TrackedCallback> callback) { | |
91 if (name > PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE) | |
92 return PP_ERROR_BADARGUMENT; | |
93 | |
94 return SetOptionImpl(name, value, | |
95 true, // Check bind() state. | |
bbudge
2015/02/13 00:03:16
This should be false (1.1 relaxed bind restriction
etrunko
2015/02/13 20:19:58
Done.
| |
96 callback); | |
97 } | |
98 | |
87 int32_t UDPSocketResource::SetOption( | 99 int32_t UDPSocketResource::SetOption( |
88 PP_UDPSocket_Option name, | 100 PP_UDPSocket_Option name, |
89 const PP_Var& value, | 101 const PP_Var& value, |
90 scoped_refptr<TrackedCallback> callback) { | 102 scoped_refptr<TrackedCallback> callback) { |
91 return SetOptionImpl(name, value, | 103 return SetOptionImpl(name, value, |
92 false, // Check bind() state. | 104 false, // Check bind() state. |
93 callback); | 105 callback); |
94 } | 106 } |
95 | 107 |
108 int32_t UDPSocketResource::JoinGroup( | |
109 PP_Resource group, | |
110 scoped_refptr<TrackedCallback> callback) { | |
111 EnterNetAddressNoLock enter(group, true); | |
112 if (enter.failed()) | |
113 return PP_ERROR_BADRESOURCE; | |
114 | |
115 return JoinGroupImpl(&enter.object()->GetNetAddressPrivate(), | |
116 callback); | |
117 } | |
118 | |
119 int32_t UDPSocketResource::LeaveGroup( | |
120 PP_Resource group, | |
121 scoped_refptr<TrackedCallback> callback) { | |
122 EnterNetAddressNoLock enter(group, true); | |
123 if (enter.failed()) | |
124 return PP_ERROR_BADRESOURCE; | |
125 | |
126 return LeaveGroupImpl(&enter.object()->GetNetAddressPrivate(), | |
127 callback); | |
128 } | |
129 | |
96 } // namespace proxy | 130 } // namespace proxy |
97 } // namespace ppapi | 131 } // namespace ppapi |
OLD | NEW |