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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_tcp_server_socket.h

Issue 19005006: Switched proxy for TCPServerSocketPrivate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync, fix. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SERVER_SOCKET_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SERVER_SOCKET_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ppapi/c/pp_resource.h"
11
12 struct PP_NetAddress_Private;
13
14 namespace net {
15 class ServerSocket;
16 class StreamSocket;
17 }
18
19 namespace content {
20 class PepperMessageFilter;
21
22 // PepperTCPSocket is used by PepperMessageFilter to handle requests
23 // from the Pepper TCP server socket API
24 // (PPB_TCPServerSocket_Private).
25 class PepperTCPServerSocket {
26 public:
27 PepperTCPServerSocket(PepperMessageFilter* manager,
28 int32 routing_id,
29 uint32 plugin_dispatcher_id,
30 PP_Resource socket_resource,
31 uint32 socket_id);
32 ~PepperTCPServerSocket();
33
34 void Listen(const PP_NetAddress_Private& addr, int32 backlog);
35 void Accept(int32 tcp_client_socket_routing_id);
36
37 private:
38 enum State {
39 BEFORE_LISTENING,
40 LISTEN_IN_PROGRESS,
41 LISTENING,
42 ACCEPT_IN_PROGRESS,
43 };
44
45 void CancelListenRequest();
46 void SendAcceptACKError();
47
48 void OnListenCompleted(int result);
49 void OnAcceptCompleted(int32 tcp_client_socket_routing_id,
50 int result);
51
52 PepperMessageFilter* manager_;
53 int32 routing_id_;
54 uint32 plugin_dispatcher_id_;
55 // socket_resource_ is used only as an ID on the browser side. So we
56 // don't hold the ref to this resource and it may become invalid at
57 // the renderer/plugin side.
58 PP_Resource socket_resource_;
59 uint32 socket_id_;
60
61 State state_;
62
63 scoped_ptr<net::ServerSocket> socket_;
64 scoped_ptr<net::StreamSocket> socket_buffer_;
65
66 DISALLOW_COPY_AND_ASSIGN(PepperTCPServerSocket);
67 };
68
69 } // namespace content
70
71 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SERVER_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698