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

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

Issue 9836131: Remove PPB_Flash_NetConnector and ENABLE_FLAPPER_HACKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/thunk/ppb_flash_net_connector_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/c/private/ppb_flash_net_connector.h"
6 #include "ppapi/c/pp_completion_callback.h"
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/ppb_flash_net_connector_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
12
13 namespace ppapi {
14 namespace thunk {
15
16 namespace {
17
18 typedef EnterResource<PPB_Flash_NetConnector_API> EnterNetConnector;
19
20 PP_Resource Create(PP_Instance instance) {
21 EnterResourceCreation enter(instance);
22 if (enter.failed())
23 return 0;
24 return enter.functions()->CreateFlashNetConnector(instance);
25 }
26
27 PP_Bool IsFlashNetConnector(PP_Resource resource) {
28 EnterNetConnector enter(resource, false);
29 return PP_FromBool(enter.succeeded());
30 }
31
32 int32_t ConnectTcp(PP_Resource resource,
33 const char* host,
34 uint16_t port,
35 PP_FileHandle* socket_out,
36 PP_NetAddress_Private* local_addr_out,
37 PP_NetAddress_Private* remote_addr_out,
38 PP_CompletionCallback callback) {
39 EnterNetConnector enter(resource, callback, true);
40 if (enter.failed())
41 return enter.retval();
42 return enter.SetResult(enter.object()->ConnectTcp(
43 host, port, socket_out, local_addr_out, remote_addr_out, callback));
44 }
45
46 int32_t ConnectTcpAddress(PP_Resource resource,
47 const PP_NetAddress_Private* addr,
48 PP_FileHandle* socket_out,
49 PP_NetAddress_Private* local_addr_out,
50 PP_NetAddress_Private* remote_addr_out,
51 PP_CompletionCallback callback) {
52 EnterNetConnector enter(resource, callback, true);
53 if (enter.failed())
54 return enter.retval();
55 return enter.SetResult(enter.object()->ConnectTcpAddress(
56 addr, socket_out, local_addr_out, remote_addr_out, callback));
57 }
58
59 const PPB_Flash_NetConnector g_ppb_flash_net_connector_thunk = {
60 &Create,
61 &IsFlashNetConnector,
62 &ConnectTcp,
63 &ConnectTcpAddress
64 };
65
66 } // namespace
67
68 const PPB_Flash_NetConnector* GetPPB_Flash_NetConnector_0_2_Thunk() {
69 return &g_ppb_flash_net_connector_thunk;
70 }
71
72 } // namespace thunk
73 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_flash_net_connector_api.h ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698