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

Side by Side Diff: ppapi/thunk/ppb_udp_socket_private_thunk.cc

Issue 8506016: Remove 'Flash' from TCP/UDP Pepper interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolved last comments Created 9 years, 1 month 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/thunk/ppb_udp_socket_private_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/c/pp_completion_callback.h" 5 #include "ppapi/c/pp_completion_callback.h"
6 #include "ppapi/c/pp_errors.h" 6 #include "ppapi/c/pp_errors.h"
7 #include "ppapi/c/private/ppb_flash_udp_socket.h" 7 #include "ppapi/c/private/ppb_udp_socket_private.h"
8 #include "ppapi/thunk/common.h" 8 #include "ppapi/thunk/common.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_flash_udp_socket_api.h" 10 #include "ppapi/thunk/ppb_udp_socket_private_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 11 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 namespace thunk { 15 namespace thunk {
16 16
17 namespace { 17 namespace {
18 18
19 PP_Resource Create(PP_Instance instance) { 19 PP_Resource Create(PP_Instance instance) {
20 EnterFunction<ResourceCreationAPI> enter(instance, true); 20 EnterFunction<ResourceCreationAPI> enter(instance, true);
21 if (enter.failed()) 21 if (enter.failed())
22 return 0; 22 return 0;
23 return enter.functions()->CreateFlashUDPSocket(instance); 23 return enter.functions()->CreateUDPSocketPrivate(instance);
24 } 24 }
25 25
26 PP_Bool IsFlashUDPSocket(PP_Resource resource) { 26 PP_Bool IsUDPSocket(PP_Resource resource) {
27 EnterResource<PPB_Flash_UDPSocket_API> enter(resource, false); 27 EnterResource<PPB_UDPSocket_Private_API> enter(resource, false);
28 return PP_FromBool(enter.succeeded()); 28 return PP_FromBool(enter.succeeded());
29 } 29 }
30 30
31 int32_t Bind(PP_Resource udp_socket, 31 int32_t Bind(PP_Resource udp_socket,
32 const PP_NetAddress_Private *addr, 32 const PP_NetAddress_Private *addr,
33 PP_CompletionCallback callback) { 33 PP_CompletionCallback callback) {
34 EnterResource<PPB_Flash_UDPSocket_API> enter(udp_socket, true); 34 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
35 if (enter.failed()) 35 if (enter.failed())
36 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 36 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
37 int32_t result = enter.object()->Bind(addr, callback); 37 int32_t result = enter.object()->Bind(addr, callback);
38 return MayForceCallback(callback, result); 38 return MayForceCallback(callback, result);
39 } 39 }
40 40
41 int32_t RecvFrom(PP_Resource udp_socket, 41 int32_t RecvFrom(PP_Resource udp_socket,
42 char* buffer, 42 char* buffer,
43 int32_t num_bytes, 43 int32_t num_bytes,
44 PP_CompletionCallback callback) { 44 PP_CompletionCallback callback) {
45 EnterResource<PPB_Flash_UDPSocket_API> enter(udp_socket, true); 45 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
46 if (enter.failed()) 46 if (enter.failed())
47 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 47 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
48 int32_t result = enter.object()->RecvFrom(buffer, 48 int32_t result = enter.object()->RecvFrom(buffer,
49 num_bytes, 49 num_bytes,
50 callback); 50 callback);
51 return MayForceCallback(callback, result); 51 return MayForceCallback(callback, result);
52 } 52 }
53 53
54 PP_Bool GetRecvFromAddress(PP_Resource udp_socket, 54 PP_Bool GetRecvFromAddress(PP_Resource udp_socket,
55 PP_NetAddress_Private* addr) { 55 PP_NetAddress_Private* addr) {
56 EnterResource<PPB_Flash_UDPSocket_API> enter(udp_socket, true); 56 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
57 if (enter.failed()) 57 if (enter.failed())
58 return PP_FALSE; 58 return PP_FALSE;
59 return enter.object()->GetRecvFromAddress(addr); 59 return enter.object()->GetRecvFromAddress(addr);
60 } 60 }
61 61
62 int32_t SendTo(PP_Resource udp_socket, 62 int32_t SendTo(PP_Resource udp_socket,
63 const char* buffer, 63 const char* buffer,
64 int32_t num_bytes, 64 int32_t num_bytes,
65 const PP_NetAddress_Private* addr, 65 const PP_NetAddress_Private* addr,
66 PP_CompletionCallback callback) { 66 PP_CompletionCallback callback) {
67 EnterResource<PPB_Flash_UDPSocket_API> enter(udp_socket, true); 67 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
68 if (enter.failed()) 68 if (enter.failed())
69 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); 69 return MayForceCallback(callback, PP_ERROR_BADRESOURCE);
70 int32_t result = enter.object()->SendTo(buffer, num_bytes, addr, callback); 70 int32_t result = enter.object()->SendTo(buffer, num_bytes, addr, callback);
71 return MayForceCallback(callback, result); 71 return MayForceCallback(callback, result);
72 } 72 }
73 73
74 void Close(PP_Resource udp_socket) { 74 void Close(PP_Resource udp_socket) {
75 EnterResource<PPB_Flash_UDPSocket_API> enter(udp_socket, true); 75 EnterResource<PPB_UDPSocket_Private_API> enter(udp_socket, true);
76 if (enter.succeeded()) 76 if (enter.succeeded())
77 enter.object()->Close(); 77 enter.object()->Close();
78 } 78 }
79 79
80 const PPB_Flash_UDPSocket g_ppb_flash_udp_socket_thunk = { 80 const PPB_UDPSocket_Private g_ppb_udp_socket_thunk = {
81 &Create, 81 &Create,
82 &IsFlashUDPSocket, 82 &IsUDPSocket,
83 &Bind, 83 &Bind,
84 &RecvFrom, 84 &RecvFrom,
85 &GetRecvFromAddress, 85 &GetRecvFromAddress,
86 &SendTo, 86 &SendTo,
87 &Close 87 &Close
88 }; 88 };
89 89
90 } // namespace 90 } // namespace
91 91
92 const PPB_Flash_UDPSocket* GetPPB_Flash_UDPSocket_Thunk() { 92 const PPB_UDPSocket_Private* GetPPB_UDPSocket_Private_Thunk() {
93 return &g_ppb_flash_udp_socket_thunk; 93 return &g_ppb_udp_socket_thunk;
94 } 94 }
95 95
96 } // namespace thunk 96 } // namespace thunk
97 } // namespace ppapi 97 } // namespace ppapi
98 98
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_udp_socket_private_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698