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

Side by Side Diff: content/renderer/pepper/ppb_tcp_socket_private_impl.h

Issue 20777009: A few more cleanups to the pepper code. Dispatch IPCs in the sockets implementations directly by ha… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix tcp tests Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "ipc/ipc_listener.h"
11 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" 12 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 class PepperHelperImpl; 16 class PPB_TCPSocket_Private_Impl : public ::ppapi::TCPSocketPrivateImpl,
16 17 public IPC::Listener {
17 class PPB_TCPSocket_Private_Impl : public ::ppapi::TCPSocketPrivateImpl {
18 public: 18 public:
19 static PP_Resource CreateResource(PP_Instance instance); 19 static PP_Resource CreateResource(PP_Instance instance);
20 static PP_Resource CreateConnectedSocket( 20 static PP_Resource CreateConnectedSocket(
21 PP_Instance instance, 21 PP_Instance instance,
22 int routing_id,
22 uint32 socket_id, 23 uint32 socket_id,
23 const PP_NetAddress_Private& local_addr, 24 const PP_NetAddress_Private& local_addr,
24 const PP_NetAddress_Private& remote_addr); 25 const PP_NetAddress_Private& remote_addr);
25 26
26 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE; 27 virtual void SendConnect(const std::string& host, uint16_t port) OVERRIDE;
27 virtual void SendConnectWithNetAddress( 28 virtual void SendConnectWithNetAddress(
28 const PP_NetAddress_Private& addr) OVERRIDE; 29 const PP_NetAddress_Private& addr) OVERRIDE;
29 virtual void SendSSLHandshake( 30 virtual void SendSSLHandshake(
30 const std::string& server_name, 31 const std::string& server_name,
31 uint16_t server_port, 32 uint16_t server_port,
32 const std::vector<std::vector<char> >& trusted_certs, 33 const std::vector<std::vector<char> >& trusted_certs,
33 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; 34 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE;
34 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; 35 virtual void SendRead(int32_t bytes_to_read) OVERRIDE;
35 virtual void SendWrite(const std::string& buffer) OVERRIDE; 36 virtual void SendWrite(const std::string& buffer) OVERRIDE;
36 virtual void SendDisconnect() OVERRIDE; 37 virtual void SendDisconnect() OVERRIDE;
37 virtual void SendSetOption(PP_TCPSocket_Option name, 38 virtual void SendSetOption(PP_TCPSocket_Option name,
38 const ::ppapi::SocketOptionData& value) OVERRIDE; 39 const ::ppapi::SocketOptionData& value) OVERRIDE;
39 40
40 private: 41 private:
41 PPB_TCPSocket_Private_Impl(PP_Instance instance, uint32 socket_id); 42 PPB_TCPSocket_Private_Impl(PP_Instance instance,
43 uint32 socket_id,
44 int routing_id);
42 virtual ~PPB_TCPSocket_Private_Impl(); 45 virtual ~PPB_TCPSocket_Private_Impl();
43 46
44 static PepperHelperImpl* GetHelper(PP_Instance instance); 47 // IPC::Listener implementation.
48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
49
50 void OnTCPSocketConnectACK(uint32 plugin_dispatcher_id,
51 uint32 socket_id,
52 int32_t result,
53 const PP_NetAddress_Private& local_addr,
54 const PP_NetAddress_Private& remote_addr);
55 void OnTCPSocketSSLHandshakeACK(
56 uint32 plugin_dispatcher_id,
57 uint32 socket_id,
58 bool succeeded,
59 const ppapi::PPB_X509Certificate_Fields& certificate_fields);
60 void OnTCPSocketReadACK(uint32 plugin_dispatcher_id,
61 uint32 socket_id,
62 int32_t result,
63 const std::string& data);
64 void OnTCPSocketWriteACK(uint32 plugin_dispatcher_id,
65 uint32 socket_id,
66 int32_t result);
67 void OnTCPSocketSetOptionACK(uint32 plugin_dispatcher_id,
68 uint32 socket_id,
69 int32_t result);
70
71 int routing_id_;
45 72
46 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl); 73 DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Impl);
47 }; 74 };
48 75
49 } // namespace content 76 } // namespace content
50 77
51 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_ 78 #endif // CONTENT_RENDERER_PEPPER_PPB_TCP_SOCKET_PRIVATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698