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

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

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USELESS PATCH TITLE Created 8 years, 10 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/cpp/dev/url_util_dev.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/cpp/dev/transport_dev.h" 5 #include "ppapi/cpp/dev/transport_dev.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/resource.h" 9 #include "ppapi/cpp/resource.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/module_impl.h" 11 #include "ppapi/cpp/module_impl.h"
12 #include "ppapi/cpp/var.h" 12 #include "ppapi/cpp/var.h"
13 13
14 namespace pp { 14 namespace pp {
15 15
16 namespace { 16 namespace {
17 17
18 template <> const char* interface_name<PPB_Transport_Dev>() { 18 template <> const char* interface_name<PPB_Transport_Dev>() {
19 return PPB_TRANSPORT_DEV_INTERFACE; 19 return PPB_TRANSPORT_DEV_INTERFACE;
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 Transport_Dev::Transport_Dev(Instance* instance, 24 Transport_Dev::Transport_Dev(const InstanceHandle& instance,
25 const char* name, 25 const char* name,
26 PP_TransportType type) { 26 PP_TransportType type) {
27 if (has_interface<PPB_Transport_Dev>()) 27 if (has_interface<PPB_Transport_Dev>())
28 PassRefFromConstructor(get_interface<PPB_Transport_Dev>()->CreateTransport( 28 PassRefFromConstructor(get_interface<PPB_Transport_Dev>()->CreateTransport(
29 instance->pp_instance(), name, type)); 29 instance.pp_instance(), name, type));
30 } 30 }
31 31
32 bool Transport_Dev::IsWritable() { 32 bool Transport_Dev::IsWritable() {
33 if (!has_interface<PPB_Transport_Dev>()) 33 if (!has_interface<PPB_Transport_Dev>())
34 return false; 34 return false;
35 return PP_ToBool( 35 return PP_ToBool(
36 get_interface<PPB_Transport_Dev>()->IsWritable(pp_resource())); 36 get_interface<PPB_Transport_Dev>()->IsWritable(pp_resource()));
37 } 37 }
38 38
39 int32_t Transport_Dev::SetProperty(PP_TransportProperty property, 39 int32_t Transport_Dev::SetProperty(PP_TransportProperty property,
(...skipping 11 matching lines...) Expand all
51 pp_resource(), cc.pp_completion_callback()); 51 pp_resource(), cc.pp_completion_callback());
52 } 52 }
53 53
54 int32_t Transport_Dev::GetNextAddress(Var* address, 54 int32_t Transport_Dev::GetNextAddress(Var* address,
55 const CompletionCallback& cc) { 55 const CompletionCallback& cc) {
56 if (!has_interface<PPB_Transport_Dev>()) 56 if (!has_interface<PPB_Transport_Dev>())
57 return cc.MayForce(PP_ERROR_NOINTERFACE); 57 return cc.MayForce(PP_ERROR_NOINTERFACE);
58 PP_Var temp_address = PP_MakeUndefined(); 58 PP_Var temp_address = PP_MakeUndefined();
59 int32_t ret_val = get_interface<PPB_Transport_Dev>()->GetNextAddress( 59 int32_t ret_val = get_interface<PPB_Transport_Dev>()->GetNextAddress(
60 pp_resource(), &temp_address, cc.pp_completion_callback()); 60 pp_resource(), &temp_address, cc.pp_completion_callback());
61 *address = Var(Var::PassRef(), temp_address); 61 *address = Var(PASS_REF, temp_address);
62 return ret_val; 62 return ret_val;
63 } 63 }
64 64
65 int32_t Transport_Dev::ReceiveRemoteAddress(const pp::Var& address) { 65 int32_t Transport_Dev::ReceiveRemoteAddress(const pp::Var& address) {
66 if (!has_interface<PPB_Transport_Dev>()) 66 if (!has_interface<PPB_Transport_Dev>())
67 return PP_ERROR_NOINTERFACE; 67 return PP_ERROR_NOINTERFACE;
68 return get_interface<PPB_Transport_Dev>()->ReceiveRemoteAddress( 68 return get_interface<PPB_Transport_Dev>()->ReceiveRemoteAddress(
69 pp_resource(), address.pp_var()); 69 pp_resource(), address.pp_var());
70 } 70 }
71 71
(...skipping 13 matching lines...) Expand all
85 pp_resource(), data, len, cc.pp_completion_callback()); 85 pp_resource(), data, len, cc.pp_completion_callback());
86 } 86 }
87 87
88 int32_t Transport_Dev::Close() { 88 int32_t Transport_Dev::Close() {
89 if (!has_interface<PPB_Transport_Dev>()) 89 if (!has_interface<PPB_Transport_Dev>())
90 return PP_ERROR_NOINTERFACE; 90 return PP_ERROR_NOINTERFACE;
91 return get_interface<PPB_Transport_Dev>()->Close(pp_resource()); 91 return get_interface<PPB_Transport_Dev>()->Close(pp_resource());
92 } 92 }
93 93
94 } // namespace pp 94 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/transport_dev.h ('k') | ppapi/cpp/dev/url_util_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698