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

Side by Side Diff: ppapi/cpp/private/udp_socket_private.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/cpp/private/udp_socket_private.h ('k') | ppapi/ppapi_cpp.gypi » ('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) 2011 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/cpp/private/udp_socket_private.h"
6
7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h"
13
14 namespace pp {
15
16 namespace {
17
18 template <> const char* interface_name<PPB_UDPSocket_Private>() {
19 return PPB_UDPSOCKET_PRIVATE_INTERFACE;
20 }
21
22 } // namespace
23
24 UDPSocketPrivate::UDPSocketPrivate(Instance* instance) {
25 if (has_interface<PPB_UDPSocket_Private>() && instance) {
26 PassRefFromConstructor(get_interface<PPB_UDPSocket_Private>()->Create(
27 instance->pp_instance()));
28 }
29 }
30
31 int32_t UDPSocketPrivate::Bind(const PP_NetAddress_Private* addr,
32 const CompletionCallback& callback) {
33 if (!has_interface<PPB_UDPSocket_Private>())
34 return PP_ERROR_NOINTERFACE;
35 return get_interface<PPB_UDPSocket_Private>()->Bind(
36 pp_resource(), addr, callback.pp_completion_callback());
37 }
38
39 int32_t UDPSocketPrivate::RecvFrom(char* buffer,
40 int32_t num_bytes,
41 const CompletionCallback& callback) {
42 if (!has_interface<PPB_UDPSocket_Private>())
43 return PP_ERROR_NOINTERFACE;
44 return get_interface<PPB_UDPSocket_Private>()->RecvFrom(
45 pp_resource(), buffer, num_bytes, callback.pp_completion_callback());
46 }
47
48 bool UDPSocketPrivate::GetRecvFromAddress(PP_NetAddress_Private* addr) {
49 if (!has_interface<PPB_UDPSocket_Private>())
50 return false;
51
52 PP_Bool result = get_interface<PPB_UDPSocket_Private>()->GetRecvFromAddress(
53 pp_resource(), addr);
54 return PP_ToBool(result);
55 }
56
57 int32_t UDPSocketPrivate::SendTo(const char* buffer,
58 int32_t num_bytes,
59 const PP_NetAddress_Private* addr,
60 const CompletionCallback& callback) {
61 if (!has_interface<PPB_UDPSocket_Private>())
62 return PP_ERROR_NOINTERFACE;
63 return get_interface<PPB_UDPSocket_Private>()->SendTo(
64 pp_resource(), buffer, num_bytes, addr,
65 callback.pp_completion_callback());
66 }
67
68 } // namespace pp
69
OLDNEW
« no previous file with comments | « ppapi/cpp/private/udp_socket_private.h ('k') | ppapi/ppapi_cpp.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698