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

Side by Side Diff: ppapi/cpp/private/tcp_socket_private.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/private/tcp_socket_private.h ('k') | ppapi/cpp/private/udp_socket_private.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/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.h" 10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/module_impl.h" 12 #include "ppapi/cpp/module_impl.h"
13 13
14 namespace pp { 14 namespace pp {
15 15
16 namespace { 16 namespace {
17 17
18 template <> const char* interface_name<PPB_TCPSocket_Private>() { 18 template <> const char* interface_name<PPB_TCPSocket_Private>() {
19 return PPB_TCPSOCKET_PRIVATE_INTERFACE; 19 return PPB_TCPSOCKET_PRIVATE_INTERFACE;
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 TCPSocketPrivate::TCPSocketPrivate(Instance* instance) { 24 TCPSocketPrivate::TCPSocketPrivate(const InstanceHandle& instance) {
25 if (has_interface<PPB_TCPSocket_Private>() && instance) { 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 // static 31 // static
32 bool TCPSocketPrivate::IsAvailable() { 32 bool TCPSocketPrivate::IsAvailable() {
33 return has_interface<PPB_TCPSocket_Private>(); 33 return has_interface<PPB_TCPSocket_Private>();
34 } 34 }
35 35
36 int32_t TCPSocketPrivate::Connect(const char* host, 36 int32_t TCPSocketPrivate::Connect(const char* host,
37 uint16_t port, 37 uint16_t port,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback()); 96 pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback());
97 } 97 }
98 98
99 void TCPSocketPrivate::Disconnect() { 99 void TCPSocketPrivate::Disconnect() {
100 if (!has_interface<PPB_TCPSocket_Private>()) 100 if (!has_interface<PPB_TCPSocket_Private>())
101 return; 101 return;
102 return get_interface<PPB_TCPSocket_Private>()->Disconnect(pp_resource()); 102 return get_interface<PPB_TCPSocket_Private>()->Disconnect(pp_resource());
103 } 103 }
104 104
105 } // namespace pp 105 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/private/tcp_socket_private.h ('k') | ppapi/cpp/private/udp_socket_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698