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

Side by Side Diff: ppapi/cpp/dev/transport_dev.cc

Issue 10454058: Remove PPB_Transport_Dev API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/cpp/dev/transport_dev.h ('k') | ppapi/ppapi_proxy_untrusted.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/dev/transport_dev.h"
6
7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/resource.h"
10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/var.h"
13
14 namespace pp {
15
16 namespace {
17
18 template <> const char* interface_name<PPB_Transport_Dev>() {
19 return PPB_TRANSPORT_DEV_INTERFACE;
20 }
21
22 } // namespace
23
24 Transport_Dev::Transport_Dev(const InstanceHandle& instance,
25 const char* name,
26 PP_TransportType type) {
27 if (has_interface<PPB_Transport_Dev>())
28 PassRefFromConstructor(get_interface<PPB_Transport_Dev>()->CreateTransport(
29 instance.pp_instance(), name, type));
30 }
31
32 bool Transport_Dev::IsWritable() {
33 if (!has_interface<PPB_Transport_Dev>())
34 return false;
35 return PP_ToBool(
36 get_interface<PPB_Transport_Dev>()->IsWritable(pp_resource()));
37 }
38
39 int32_t Transport_Dev::SetProperty(PP_TransportProperty property,
40 const Var& value) {
41 if (!has_interface<PPB_Transport_Dev>())
42 return PP_ERROR_NOINTERFACE;
43 return get_interface<PPB_Transport_Dev>()->SetProperty(
44 pp_resource(), property, value.pp_var());
45 }
46
47 int32_t Transport_Dev::Connect(const CompletionCallback& cc) {
48 if (!has_interface<PPB_Transport_Dev>())
49 return cc.MayForce(PP_ERROR_NOINTERFACE);
50 return get_interface<PPB_Transport_Dev>()->Connect(
51 pp_resource(), cc.pp_completion_callback());
52 }
53
54 int32_t Transport_Dev::GetNextAddress(Var* address,
55 const CompletionCallback& cc) {
56 if (!has_interface<PPB_Transport_Dev>())
57 return cc.MayForce(PP_ERROR_NOINTERFACE);
58 PP_Var temp_address = PP_MakeUndefined();
59 int32_t ret_val = get_interface<PPB_Transport_Dev>()->GetNextAddress(
60 pp_resource(), &temp_address, cc.pp_completion_callback());
61 *address = Var(PASS_REF, temp_address);
62 return ret_val;
63 }
64
65 int32_t Transport_Dev::ReceiveRemoteAddress(const pp::Var& address) {
66 if (!has_interface<PPB_Transport_Dev>())
67 return PP_ERROR_NOINTERFACE;
68 return get_interface<PPB_Transport_Dev>()->ReceiveRemoteAddress(
69 pp_resource(), address.pp_var());
70 }
71
72 int32_t Transport_Dev::Recv(void* data, uint32_t len,
73 const CompletionCallback& cc) {
74 if (!has_interface<PPB_Transport_Dev>())
75 return cc.MayForce(PP_ERROR_NOINTERFACE);
76 return get_interface<PPB_Transport_Dev>()->Recv(
77 pp_resource(), data, len, cc.pp_completion_callback());
78 }
79
80 int32_t Transport_Dev::Send(const void* data, uint32_t len,
81 const CompletionCallback& cc) {
82 if (!has_interface<PPB_Transport_Dev>())
83 return cc.MayForce(PP_ERROR_NOINTERFACE);
84 return get_interface<PPB_Transport_Dev>()->Send(
85 pp_resource(), data, len, cc.pp_completion_callback());
86 }
87
88 int32_t Transport_Dev::Close() {
89 if (!has_interface<PPB_Transport_Dev>())
90 return PP_ERROR_NOINTERFACE;
91 return get_interface<PPB_Transport_Dev>()->Close(pp_resource());
92 }
93
94 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/transport_dev.h ('k') | ppapi/ppapi_proxy_untrusted.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698