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

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

Issue 17419008: Move PPB_NetAddress out of dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/udp_socket_dev.h ('k') | ppapi/cpp/net_address.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/udp_socket_dev.h" 5 #include "ppapi/cpp/dev/udp_socket_dev.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/cpp/completion_callback.h" 8 #include "ppapi/cpp/completion_callback.h"
9 #include "ppapi/cpp/instance_handle.h" 9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module_impl.h" 10 #include "ppapi/cpp/module_impl.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 UDPSocket_Dev& UDPSocket_Dev::operator=(const UDPSocket_Dev& other) { 43 UDPSocket_Dev& UDPSocket_Dev::operator=(const UDPSocket_Dev& other) {
44 Resource::operator=(other); 44 Resource::operator=(other);
45 return *this; 45 return *this;
46 } 46 }
47 47
48 // static 48 // static
49 bool UDPSocket_Dev::IsAvailable() { 49 bool UDPSocket_Dev::IsAvailable() {
50 return has_interface<PPB_UDPSocket_Dev_0_1>(); 50 return has_interface<PPB_UDPSocket_Dev_0_1>();
51 } 51 }
52 52
53 int32_t UDPSocket_Dev::Bind(const NetAddress_Dev& addr, 53 int32_t UDPSocket_Dev::Bind(const NetAddress& addr,
54 const CompletionCallback& callback) { 54 const CompletionCallback& callback) {
55 if (has_interface<PPB_UDPSocket_Dev_0_1>()) { 55 if (has_interface<PPB_UDPSocket_Dev_0_1>()) {
56 return get_interface<PPB_UDPSocket_Dev_0_1>()->Bind( 56 return get_interface<PPB_UDPSocket_Dev_0_1>()->Bind(
57 pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); 57 pp_resource(), addr.pp_resource(), callback.pp_completion_callback());
58 } 58 }
59 return callback.MayForce(PP_ERROR_NOINTERFACE); 59 return callback.MayForce(PP_ERROR_NOINTERFACE);
60 } 60 }
61 61
62 NetAddress_Dev UDPSocket_Dev::GetBoundAddress() { 62 NetAddress UDPSocket_Dev::GetBoundAddress() {
63 if (has_interface<PPB_UDPSocket_Dev_0_1>()) { 63 if (has_interface<PPB_UDPSocket_Dev_0_1>()) {
64 return NetAddress_Dev( 64 return NetAddress(
65 PASS_REF, 65 PASS_REF,
66 get_interface<PPB_UDPSocket_Dev_0_1>()->GetBoundAddress(pp_resource())); 66 get_interface<PPB_UDPSocket_Dev_0_1>()->GetBoundAddress(pp_resource()));
67 } 67 }
68 return NetAddress_Dev(); 68 return NetAddress();
69 } 69 }
70 70
71 int32_t UDPSocket_Dev::RecvFrom( 71 int32_t UDPSocket_Dev::RecvFrom(
72 char* buffer, 72 char* buffer,
73 int32_t num_bytes, 73 int32_t num_bytes,
74 const CompletionCallbackWithOutput<NetAddress_Dev>& callback) { 74 const CompletionCallbackWithOutput<NetAddress>& callback) {
75 if (has_interface<PPB_UDPSocket_Dev_0_1>()) { 75 if (has_interface<PPB_UDPSocket_Dev_0_1>()) {
76 return get_interface<PPB_UDPSocket_Dev_0_1>()->RecvFrom( 76 return get_interface<PPB_UDPSocket_Dev_0_1>()->RecvFrom(
77 pp_resource(), buffer, num_bytes, callback.output(), 77 pp_resource(), buffer, num_bytes, callback.output(),
78 callback.pp_completion_callback()); 78 callback.pp_completion_callback());
79 } 79 }
80 return callback.MayForce(PP_ERROR_NOINTERFACE); 80 return callback.MayForce(PP_ERROR_NOINTERFACE);
81 } 81 }
82 82
83 int32_t UDPSocket_Dev::SendTo(const char* buffer, 83 int32_t UDPSocket_Dev::SendTo(const char* buffer,
84 int32_t num_bytes, 84 int32_t num_bytes,
85 const NetAddress_Dev& addr, 85 const NetAddress& addr,
86 const CompletionCallback& callback) { 86 const CompletionCallback& callback) {
87 if (has_interface<PPB_UDPSocket_Dev_0_1>()) { 87 if (has_interface<PPB_UDPSocket_Dev_0_1>()) {
88 return get_interface<PPB_UDPSocket_Dev_0_1>()->SendTo( 88 return get_interface<PPB_UDPSocket_Dev_0_1>()->SendTo(
89 pp_resource(), buffer, num_bytes, addr.pp_resource(), 89 pp_resource(), buffer, num_bytes, addr.pp_resource(),
90 callback.pp_completion_callback()); 90 callback.pp_completion_callback());
91 } 91 }
92 return callback.MayForce(PP_ERROR_NOINTERFACE); 92 return callback.MayForce(PP_ERROR_NOINTERFACE);
93 } 93 }
94 94
95 void UDPSocket_Dev::Close() { 95 void UDPSocket_Dev::Close() {
96 if (has_interface<PPB_UDPSocket_Dev_0_1>()) 96 if (has_interface<PPB_UDPSocket_Dev_0_1>())
97 return get_interface<PPB_UDPSocket_Dev_0_1>()->Close(pp_resource()); 97 return get_interface<PPB_UDPSocket_Dev_0_1>()->Close(pp_resource());
98 } 98 }
99 99
100 int32_t UDPSocket_Dev::SetOption(PP_UDPSocket_Option_Dev name, 100 int32_t UDPSocket_Dev::SetOption(PP_UDPSocket_Option_Dev name,
101 const Var& value, 101 const Var& value,
102 const CompletionCallback& callback) { 102 const CompletionCallback& callback) {
103 if (has_interface<PPB_UDPSocket_Dev_0_1>()) { 103 if (has_interface<PPB_UDPSocket_Dev_0_1>()) {
104 return get_interface<PPB_UDPSocket_Dev_0_1>()->SetOption( 104 return get_interface<PPB_UDPSocket_Dev_0_1>()->SetOption(
105 pp_resource(), name, value.pp_var(), 105 pp_resource(), name, value.pp_var(),
106 callback.pp_completion_callback()); 106 callback.pp_completion_callback());
107 } 107 }
108 return callback.MayForce(PP_ERROR_NOINTERFACE); 108 return callback.MayForce(PP_ERROR_NOINTERFACE);
109 } 109 }
110 110
111 } // namespace pp 111 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/udp_socket_dev.h ('k') | ppapi/cpp/net_address.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698