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

Side by Side Diff: ppapi/proxy/udp_socket_resource.cc

Issue 704133005: Pepper: Add support for multicast in PPB_UDPSocket API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests, thunk code auto generated Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
82 if (name > PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE)
83 return PP_ERROR_BADARGUMENT;
84
82 return SetOptionImpl(name, value, 85 return SetOptionImpl(name, value,
83 true, // Check bind() state. 86 true, // Check bind() state.
84 callback); 87 callback);
85 } 88 }
86 89
90 int32_t UDPSocketResource::SetOption1_1(
91 PP_UDPSocket_Option name,
92 const PP_Var& value,
93 scoped_refptr<TrackedCallback> callback) {
94 if (name > PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE)
95 return PP_ERROR_BADARGUMENT;
96
97 return SetOptionImpl(name, value,
98 false, // Check bind() state.
99 callback);
100 }
101
87 int32_t UDPSocketResource::SetOption( 102 int32_t UDPSocketResource::SetOption(
88 PP_UDPSocket_Option name, 103 PP_UDPSocket_Option name,
89 const PP_Var& value, 104 const PP_Var& value,
90 scoped_refptr<TrackedCallback> callback) { 105 scoped_refptr<TrackedCallback> callback) {
91 return SetOptionImpl(name, value, 106 return SetOptionImpl(name, value,
92 false, // Check bind() state. 107 false, // Check bind() state.
93 callback); 108 callback);
94 } 109 }
95 110
111 int32_t UDPSocketResource::JoinGroup(
112 PP_Resource group,
113 scoped_refptr<TrackedCallback> callback) {
114 EnterNetAddressNoLock enter(group, true);
115 if (enter.failed())
116 return PP_ERROR_BADRESOURCE;
117
118 return JoinGroupImpl(&enter.object()->GetNetAddressPrivate(),
119 callback);
120 }
121
122 int32_t UDPSocketResource::LeaveGroup(
123 PP_Resource group,
124 scoped_refptr<TrackedCallback> callback) {
125 EnterNetAddressNoLock enter(group, true);
126 if (enter.failed())
127 return PP_ERROR_BADRESOURCE;
128
129 return LeaveGroupImpl(&enter.object()->GetNetAddressPrivate(),
130 callback);
131 }
132
96 } // namespace proxy 133 } // namespace proxy
97 } // namespace ppapi 134 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698