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

Side by Side Diff: ppapi/cpp/private/tcp_socket_private.cc

Issue 9568007: Added CPP wrapper for PPB_TCPServerSocket_Private. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: TCPSocketPrivate constructor from PP_Resource marked as 'explicit', deleted unused inclusions. Created 8 years, 9 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
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/private/tcp_socket_private.h" 5 #include "ppapi/cpp/private/tcp_socket_private.h"
6 6
7 #include "ppapi/c/pp_bool.h" 7 #include "ppapi/c/pp_bool.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/cpp/completion_callback.h" 9 #include "ppapi/cpp/completion_callback.h"
10 #include "ppapi/cpp/instance_handle.h" 10 #include "ppapi/cpp/instance_handle.h"
(...skipping 10 matching lines...) Expand all
21 21
22 } // namespace 22 } // namespace
23 23
24 TCPSocketPrivate::TCPSocketPrivate(const InstanceHandle& instance) { 24 TCPSocketPrivate::TCPSocketPrivate(const InstanceHandle& instance) {
25 if (has_interface<PPB_TCPSocket_Private>()) { 25 if (has_interface<PPB_TCPSocket_Private>()) {
26 PassRefFromConstructor(get_interface<PPB_TCPSocket_Private>()->Create( 26 PassRefFromConstructor(get_interface<PPB_TCPSocket_Private>()->Create(
27 instance.pp_instance())); 27 instance.pp_instance()));
28 } 28 }
29 } 29 }
30 30
31 TCPSocketPrivate::TCPSocketPrivate(PP_Resource resource) {
32 if (has_interface<PPB_TCPSocket_Private>() &&
33 get_interface<PPB_TCPSocket_Private>()->IsTCPSocket(resource)) {
34 PassRefFromConstructor(resource);
35 }
36 }
37
31 // static 38 // static
32 bool TCPSocketPrivate::IsAvailable() { 39 bool TCPSocketPrivate::IsAvailable() {
33 return has_interface<PPB_TCPSocket_Private>(); 40 return has_interface<PPB_TCPSocket_Private>();
34 } 41 }
35 42
36 int32_t TCPSocketPrivate::Connect(const char* host, 43 int32_t TCPSocketPrivate::Connect(const char* host,
37 uint16_t port, 44 uint16_t port,
38 const CompletionCallback& callback) { 45 const CompletionCallback& callback) {
39 if (!has_interface<PPB_TCPSocket_Private>()) 46 if (!has_interface<PPB_TCPSocket_Private>())
40 return callback.MayForce(PP_ERROR_NOINTERFACE); 47 return callback.MayForce(PP_ERROR_NOINTERFACE);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback()); 103 pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback());
97 } 104 }
98 105
99 void TCPSocketPrivate::Disconnect() { 106 void TCPSocketPrivate::Disconnect() {
100 if (!has_interface<PPB_TCPSocket_Private>()) 107 if (!has_interface<PPB_TCPSocket_Private>())
101 return; 108 return;
102 return get_interface<PPB_TCPSocket_Private>()->Disconnect(pp_resource()); 109 return get_interface<PPB_TCPSocket_Private>()->Disconnect(pp_resource());
103 } 110 }
104 111
105 } // namespace pp 112 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698