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

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

Issue 16959005: Implement PPB_UDPSocket_Dev: part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.cc ('k') | ppapi/proxy/udp_socket_resource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "ppapi/c/dev/ppb_udp_socket_dev.h"
7 #include "ppapi/shared_impl/tracked_callback.h" 9 #include "ppapi/shared_impl/tracked_callback.h"
8 10
9 namespace ppapi { 11 namespace ppapi {
10 namespace proxy { 12 namespace proxy {
11 13
12 UDPSocketPrivateResource::UDPSocketPrivateResource(Connection connection, 14 UDPSocketPrivateResource::UDPSocketPrivateResource(Connection connection,
13 PP_Instance instance) 15 PP_Instance instance)
14 : UDPSocketResourceBase(connection, instance) { 16 : UDPSocketResourceBase(connection, instance, true) {
15 } 17 }
16 18
17 UDPSocketPrivateResource::~UDPSocketPrivateResource() { 19 UDPSocketPrivateResource::~UDPSocketPrivateResource() {
18 } 20 }
19 21
20 thunk::PPB_UDPSocket_Private_API* 22 thunk::PPB_UDPSocket_Private_API*
21 UDPSocketPrivateResource::AsPPB_UDPSocket_Private_API() { 23 UDPSocketPrivateResource::AsPPB_UDPSocket_Private_API() {
22 return this; 24 return this;
23 } 25 }
24 26
25 int32_t UDPSocketPrivateResource::SetSocketFeature( 27 int32_t UDPSocketPrivateResource::SetSocketFeature(
26 PP_UDPSocketFeature_Private name, 28 PP_UDPSocketFeature_Private name,
27 PP_Var value) { 29 PP_Var value) {
28 return SetSocketFeatureImpl(name, value); 30 PP_UDPSocket_Option_Dev public_name = PP_UDPSOCKET_OPTION_ADDRESS_REUSE;
31 switch (name) {
32 case PP_UDPSOCKETFEATURE_ADDRESS_REUSE:
33 // |public_name| has been initialized above.
34 break;
35 case PP_UDPSOCKETFEATURE_BROADCAST:
36 public_name = PP_UDPSOCKET_OPTION_BROADCAST;
37 break;
38 case PP_UDPSOCKETFEATURE_COUNT:
39 return PP_ERROR_BADARGUMENT;
40 default:
41 NOTREACHED();
42 return PP_ERROR_BADARGUMENT;
43 }
44 int32_t result = SetOptionImpl(public_name, value, NULL);
45 return result == PP_OK_COMPLETIONPENDING ? PP_OK : result;
29 } 46 }
30 47
31 int32_t UDPSocketPrivateResource::Bind( 48 int32_t UDPSocketPrivateResource::Bind(
32 const PP_NetAddress_Private* addr, 49 const PP_NetAddress_Private* addr,
33 scoped_refptr<TrackedCallback> callback) { 50 scoped_refptr<TrackedCallback> callback) {
34 return BindImpl(addr, callback); 51 return BindImpl(addr, callback);
35 } 52 }
36 53
37 PP_Bool UDPSocketPrivateResource::GetBoundAddress(PP_NetAddress_Private* addr) { 54 PP_Bool UDPSocketPrivateResource::GetBoundAddress(PP_NetAddress_Private* addr) {
38 return GetBoundAddressImpl(addr); 55 return GetBoundAddressImpl(addr);
(...skipping 18 matching lines...) Expand all
57 scoped_refptr<TrackedCallback> callback) { 74 scoped_refptr<TrackedCallback> callback) {
58 return SendToImpl(buffer, num_bytes, addr, callback); 75 return SendToImpl(buffer, num_bytes, addr, callback);
59 } 76 }
60 77
61 void UDPSocketPrivateResource::Close() { 78 void UDPSocketPrivateResource::Close() {
62 CloseImpl(); 79 CloseImpl();
63 } 80 }
64 81
65 } // namespace proxy 82 } // namespace proxy
66 } // namespace ppapi 83 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_param_traits.cc ('k') | ppapi/proxy/udp_socket_resource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698