OLD | NEW |
---|---|
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_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ppapi/c/pp_resource.h" | |
11 | 12 |
12 class PepperMessageFilter; | 13 class PepperMessageFilter; |
13 struct PP_NetAddress_Private; | 14 struct PP_NetAddress_Private; |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 class ServerSocket; | 17 class ServerSocket; |
17 class StreamSocket; | 18 class StreamSocket; |
18 } | 19 } |
19 | 20 |
20 // PepperTCPSocket is used by PepperMessageFilter to handle requests | 21 // PepperTCPSocket is used by PepperMessageFilter to handle requests |
21 // from the Pepper TCP server socket API | 22 // from the Pepper TCP server socket API |
22 // (PPB_TCPServerSocket_Private). | 23 // (PPB_TCPServerSocket_Private). |
23 class PepperTCPServerSocket { | 24 class PepperTCPServerSocket { |
24 public: | 25 public: |
25 PepperTCPServerSocket(PepperMessageFilter* manager, | 26 PepperTCPServerSocket(PepperMessageFilter* manager, |
26 int32 routing_id, | 27 int32 routing_id, |
27 uint32 plugin_dispatcher_id, | 28 uint32 plugin_dispatcher_id, |
28 uint32 real_socket_id, | 29 PP_Resource socket_resource, |
29 uint32 temp_socket_id); | 30 uint32 real_socket_id); |
30 ~PepperTCPServerSocket(); | 31 ~PepperTCPServerSocket(); |
31 | 32 |
32 void Listen(const PP_NetAddress_Private& addr, int32 backlog); | 33 void Listen(const PP_NetAddress_Private& addr, int32 backlog); |
33 void Accept(); | 34 void Accept(int32 tcp_client_sockets_routing_id); |
34 | 35 |
35 private: | 36 private: |
36 enum State { | 37 enum State { |
37 BEFORE_LISTENING, | 38 BEFORE_LISTENING, |
38 LISTEN_IN_PROGRESS, | 39 LISTEN_IN_PROGRESS, |
39 LISTENING, | 40 LISTENING, |
40 ACCEPT_IN_PROGRESS, | 41 ACCEPT_IN_PROGRESS, |
41 }; | 42 }; |
42 | 43 |
43 void CancelListenRequest(); | 44 void CancelListenRequest(); |
44 void SendAcceptACKError(); | 45 void SendAcceptACKError(); |
45 | 46 |
46 void OnListenCompleted(int result); | 47 void OnListenCompleted(int result); |
47 void OnAcceptCompleted(int result); | 48 void OnAcceptCompleted(int32 tcp_client_sockets_routing_id, |
49 int result); | |
48 | 50 |
49 PepperMessageFilter* manager_; | 51 PepperMessageFilter* manager_; |
50 int32 routing_id_; | 52 int32 routing_id_; |
51 uint32 plugin_dispatcher_id_; | 53 uint32 plugin_dispatcher_id_; |
54 PP_Resource socket_resource_; | |
yzshen1
2012/03/13 17:46:32
Please consider commenting that this is used as an
ygorshenin1
2012/03/14 11:36:18
Done.
| |
52 uint32 real_socket_id_; | 55 uint32 real_socket_id_; |
yzshen1
2012/03/13 17:46:32
Please change it to socket_id.
ygorshenin1
2012/03/14 11:36:18
Done.
| |
53 uint32 temp_socket_id_; | |
54 | 56 |
55 State state_; | 57 State state_; |
56 | 58 |
57 scoped_ptr<net::ServerSocket> socket_; | 59 scoped_ptr<net::ServerSocket> socket_; |
58 scoped_ptr<net::StreamSocket> socket_buffer_; | 60 scoped_ptr<net::StreamSocket> socket_buffer_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket); | 62 DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket); |
61 }; | 63 }; |
62 | 64 |
63 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ | 65 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_TCP_SERVER_SOCKET_H_ |
OLD | NEW |