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

Side by Side Diff: ppapi/proxy/tcp_socket_private_resource.cc

Issue 24195004: PPB_TCPSocket: add support for TCP server socket operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/proxy/tcp_socket_private_resource.h ('k') | ppapi/proxy/tcp_socket_resource.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/proxy/tcp_socket_private_resource.h" 5 #include "ppapi/proxy/tcp_socket_private_resource.h"
6 6
7 #include "ppapi/proxy/ppapi_messages.h" 7 #include "ppapi/proxy/ppapi_messages.h"
8 #include "ppapi/shared_impl/ppb_tcp_socket_shared.h"
8 9
9 namespace ppapi { 10 namespace ppapi {
10 namespace proxy { 11 namespace proxy {
11 12
12 TCPSocketPrivateResource::TCPSocketPrivateResource(Connection connection, 13 TCPSocketPrivateResource::TCPSocketPrivateResource(Connection connection,
13 PP_Instance instance) 14 PP_Instance instance)
14 : TCPSocketResourceBase(connection, instance, true) { 15 : TCPSocketResourceBase(connection, instance, TCP_SOCKET_VERSION_PRIVATE) {
15 SendCreate(BROWSER, PpapiHostMsg_TCPSocket_CreatePrivate()); 16 SendCreate(BROWSER, PpapiHostMsg_TCPSocket_CreatePrivate());
16 } 17 }
17 18
18 TCPSocketPrivateResource::TCPSocketPrivateResource( 19 TCPSocketPrivateResource::TCPSocketPrivateResource(
19 Connection connection, 20 Connection connection,
20 PP_Instance instance, 21 PP_Instance instance,
21 int pending_resource_id, 22 int pending_resource_id,
22 const PP_NetAddress_Private& local_addr, 23 const PP_NetAddress_Private& local_addr,
23 const PP_NetAddress_Private& remote_addr) 24 const PP_NetAddress_Private& remote_addr)
24 : TCPSocketResourceBase(connection, instance, true, 25 : TCPSocketResourceBase(connection, instance, TCP_SOCKET_VERSION_PRIVATE,
25 local_addr, 26 local_addr, remote_addr) {
26 remote_addr) {
27 AttachToPendingHost(BROWSER, pending_resource_id); 27 AttachToPendingHost(BROWSER, pending_resource_id);
28 } 28 }
29 29
30 TCPSocketPrivateResource::~TCPSocketPrivateResource() { 30 TCPSocketPrivateResource::~TCPSocketPrivateResource() {
31 DisconnectImpl();
32 } 31 }
33 32
34 thunk::PPB_TCPSocket_Private_API* 33 thunk::PPB_TCPSocket_Private_API*
35 TCPSocketPrivateResource::AsPPB_TCPSocket_Private_API() { 34 TCPSocketPrivateResource::AsPPB_TCPSocket_Private_API() {
36 return this; 35 return this;
37 } 36 }
38 37
39 int32_t TCPSocketPrivateResource::Connect( 38 int32_t TCPSocketPrivateResource::Connect(
40 const char* host, 39 const char* host,
41 uint16_t port, 40 uint16_t port,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 83 }
85 84
86 int32_t TCPSocketPrivateResource::Write( 85 int32_t TCPSocketPrivateResource::Write(
87 const char* buffer, 86 const char* buffer,
88 int32_t bytes_to_write, 87 int32_t bytes_to_write,
89 scoped_refptr<TrackedCallback> callback) { 88 scoped_refptr<TrackedCallback> callback) {
90 return WriteImpl(buffer, bytes_to_write, callback); 89 return WriteImpl(buffer, bytes_to_write, callback);
91 } 90 }
92 91
93 void TCPSocketPrivateResource::Disconnect() { 92 void TCPSocketPrivateResource::Disconnect() {
94 DisconnectImpl(); 93 CloseImpl();
95 } 94 }
96 95
97 int32_t TCPSocketPrivateResource::SetOption( 96 int32_t TCPSocketPrivateResource::SetOption(
98 PP_TCPSocketOption_Private name, 97 PP_TCPSocketOption_Private name,
99 const PP_Var& value, 98 const PP_Var& value,
100 scoped_refptr<TrackedCallback> callback) { 99 scoped_refptr<TrackedCallback> callback) {
101 switch (name) { 100 switch (name) {
102 case PP_TCPSOCKETOPTION_PRIVATE_INVALID: 101 case PP_TCPSOCKETOPTION_PRIVATE_INVALID:
103 return PP_ERROR_BADARGUMENT; 102 return PP_ERROR_BADARGUMENT;
104 case PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY: 103 case PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY:
105 return SetOptionImpl(PP_TCPSOCKET_OPTION_NO_DELAY, value, callback); 104 return SetOptionImpl(PP_TCPSOCKET_OPTION_NO_DELAY, value, callback);
106 default: 105 default:
107 NOTREACHED(); 106 NOTREACHED();
108 return PP_ERROR_BADARGUMENT; 107 return PP_ERROR_BADARGUMENT;
109 } 108 }
110 } 109 }
111 110
111 PP_Resource TCPSocketPrivateResource::CreateAcceptedSocket(
112 int /* pending_host_id */,
113 const PP_NetAddress_Private& /* local_addr */,
114 const PP_NetAddress_Private& /* remote_addr */) {
115 NOTREACHED();
116 return 0;
117 }
118
112 } // namespace proxy 119 } // namespace proxy
113 } // namespace ppapi 120 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/tcp_socket_private_resource.h ('k') | ppapi/proxy/tcp_socket_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698