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

Side by Side Diff: ppapi/cpp/dev/tcp_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/tcp_socket_dev.h ('k') | ppapi/cpp/dev/udp_socket_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 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/tcp_socket_dev.h" 5 #include "ppapi/cpp/dev/tcp_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 TCPSocket_Dev& TCPSocket_Dev::operator=(const TCPSocket_Dev& other) { 42 TCPSocket_Dev& TCPSocket_Dev::operator=(const TCPSocket_Dev& other) {
43 Resource::operator=(other); 43 Resource::operator=(other);
44 return *this; 44 return *this;
45 } 45 }
46 46
47 // static 47 // static
48 bool TCPSocket_Dev::IsAvailable() { 48 bool TCPSocket_Dev::IsAvailable() {
49 return has_interface<PPB_TCPSocket_Dev_0_1>(); 49 return has_interface<PPB_TCPSocket_Dev_0_1>();
50 } 50 }
51 51
52 int32_t TCPSocket_Dev::Connect(const NetAddress_Dev& addr, 52 int32_t TCPSocket_Dev::Connect(const NetAddress& addr,
53 const CompletionCallback& callback) { 53 const CompletionCallback& callback) {
54 if (has_interface<PPB_TCPSocket_Dev_0_1>()) { 54 if (has_interface<PPB_TCPSocket_Dev_0_1>()) {
55 return get_interface<PPB_TCPSocket_Dev_0_1>()->Connect( 55 return get_interface<PPB_TCPSocket_Dev_0_1>()->Connect(
56 pp_resource(), addr.pp_resource(), callback.pp_completion_callback()); 56 pp_resource(), addr.pp_resource(), callback.pp_completion_callback());
57 } 57 }
58 return callback.MayForce(PP_ERROR_NOINTERFACE); 58 return callback.MayForce(PP_ERROR_NOINTERFACE);
59 } 59 }
60 60
61 NetAddress_Dev TCPSocket_Dev::GetLocalAddress() const { 61 NetAddress TCPSocket_Dev::GetLocalAddress() const {
62 if (has_interface<PPB_TCPSocket_Dev_0_1>()) { 62 if (has_interface<PPB_TCPSocket_Dev_0_1>()) {
63 return NetAddress_Dev( 63 return NetAddress(
64 PASS_REF, 64 PASS_REF,
65 get_interface<PPB_TCPSocket_Dev_0_1>()->GetLocalAddress(pp_resource())); 65 get_interface<PPB_TCPSocket_Dev_0_1>()->GetLocalAddress(pp_resource()));
66 } 66 }
67 return NetAddress_Dev(); 67 return NetAddress();
68 } 68 }
69 69
70 NetAddress_Dev TCPSocket_Dev::GetRemoteAddress() const { 70 NetAddress TCPSocket_Dev::GetRemoteAddress() const {
71 if (has_interface<PPB_TCPSocket_Dev_0_1>()) { 71 if (has_interface<PPB_TCPSocket_Dev_0_1>()) {
72 return NetAddress_Dev( 72 return NetAddress(
73 PASS_REF, 73 PASS_REF,
74 get_interface<PPB_TCPSocket_Dev_0_1>()->GetRemoteAddress( 74 get_interface<PPB_TCPSocket_Dev_0_1>()->GetRemoteAddress(
75 pp_resource())); 75 pp_resource()));
76 } 76 }
77 return NetAddress_Dev(); 77 return NetAddress();
78 } 78 }
79 79
80 int32_t TCPSocket_Dev::Read(char* buffer, 80 int32_t TCPSocket_Dev::Read(char* buffer,
81 int32_t bytes_to_read, 81 int32_t bytes_to_read,
82 const CompletionCallback& callback) { 82 const CompletionCallback& callback) {
83 if (has_interface<PPB_TCPSocket_Dev_0_1>()) { 83 if (has_interface<PPB_TCPSocket_Dev_0_1>()) {
84 return get_interface<PPB_TCPSocket_Dev_0_1>()->Read( 84 return get_interface<PPB_TCPSocket_Dev_0_1>()->Read(
85 pp_resource(), buffer, bytes_to_read, 85 pp_resource(), buffer, bytes_to_read,
86 callback.pp_completion_callback()); 86 callback.pp_completion_callback());
87 } 87 }
(...skipping 20 matching lines...) Expand all
108 const Var& value, 108 const Var& value,
109 const CompletionCallback& callback) { 109 const CompletionCallback& callback) {
110 if (has_interface<PPB_TCPSocket_Dev_0_1>()) { 110 if (has_interface<PPB_TCPSocket_Dev_0_1>()) {
111 return get_interface<PPB_TCPSocket_Dev_0_1>()->SetOption( 111 return get_interface<PPB_TCPSocket_Dev_0_1>()->SetOption(
112 pp_resource(), name, value.pp_var(), callback.pp_completion_callback()); 112 pp_resource(), name, value.pp_var(), callback.pp_completion_callback());
113 } 113 }
114 return callback.MayForce(PP_ERROR_NOINTERFACE); 114 return callback.MayForce(PP_ERROR_NOINTERFACE);
115 } 115 }
116 116
117 } // namespace pp 117 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/tcp_socket_dev.h ('k') | ppapi/cpp/dev/udp_socket_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698