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

Side by Side Diff: ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h

Issue 9669038: Added out-of-process support for server sockets. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync. Created 8 years, 9 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
« no previous file with comments | « ppapi/shared_impl/api_id.h ('k') | ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc » ('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) 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 PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_ 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_
6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_ 6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "ppapi/c/pp_completion_callback.h" 9 #include "ppapi/c/pp_completion_callback.h"
10 #include "ppapi/shared_impl/resource.h" 10 #include "ppapi/shared_impl/resource.h"
(...skipping 22 matching lines...) Expand all
33 AsPPB_TCPServerSocket_Private_API() OVERRIDE; 33 AsPPB_TCPServerSocket_Private_API() OVERRIDE;
34 34
35 // PPB_TCPServerSocket_Private_API implementation. 35 // PPB_TCPServerSocket_Private_API implementation.
36 virtual int32_t Listen(const PP_NetAddress_Private* addr, 36 virtual int32_t Listen(const PP_NetAddress_Private* addr,
37 int32_t backlog, 37 int32_t backlog,
38 PP_CompletionCallback callback) OVERRIDE; 38 PP_CompletionCallback callback) OVERRIDE;
39 virtual int32_t Accept(PP_Resource* tcp_socket, 39 virtual int32_t Accept(PP_Resource* tcp_socket,
40 PP_CompletionCallback callback) OVERRIDE; 40 PP_CompletionCallback callback) OVERRIDE;
41 virtual void StopListening() OVERRIDE; 41 virtual void StopListening() OVERRIDE;
42 42
43 void OnListenCompleted(uint32 real_socket_id, int32_t status); 43 void OnListenCompleted(uint32 socket_id, int32_t status);
44 virtual void OnAcceptCompleted(bool succeeded, 44 virtual void OnAcceptCompleted(bool succeeded,
45 uint32 tcp_socket_id, 45 uint32 accepted_socket_id,
46 const PP_NetAddress_Private& local_addr, 46 const PP_NetAddress_Private& local_addr,
47 const PP_NetAddress_Private& remote_addr) = 0; 47 const PP_NetAddress_Private& remote_addr) = 0;
48 48
49 // Send functions that need to be implemented differently for the 49 // Send functions that need to be implemented differently for the
50 // proxied and non-proxied derived classes. 50 // proxied and non-proxied derived classes.
51 virtual void SendListen(uint32 temp_socket_id, 51 virtual void SendListen(const PP_NetAddress_Private& addr,
52 const PP_NetAddress_Private& addr,
53 int32_t backlog) = 0; 52 int32_t backlog) = 0;
54 virtual void SendAccept() = 0; 53 virtual void SendAccept() = 0;
55 virtual void SendStopListening() = 0; 54 virtual void SendStopListening() = 0;
56 55
57 protected: 56 protected:
58 enum State { 57 enum State {
59 // Before listening (including a listen request is pending or a 58 // Before listening (including a listen request is pending or a
60 // previous listen request failed). 59 // previous listen request failed).
61 BEFORE_LISTENING, 60 BEFORE_LISTENING,
62 // Socket is successfully bound and in listening mode. 61 // Socket is successfully bound and in listening mode.
63 LISTENING, 62 LISTENING,
64 // The socket is closed. 63 // The socket is closed.
65 CLOSED 64 CLOSED
66 }; 65 };
67 66
68 static uint32 GenerateTempSocketID(); 67 uint32 socket_id_;
69
70 uint32 real_socket_id_;
71 uint32 temp_socket_id_;
72 State state_; 68 State state_;
73 69
74 scoped_refptr<TrackedCallback> listen_callback_; 70 scoped_refptr<TrackedCallback> listen_callback_;
75 scoped_refptr<TrackedCallback> accept_callback_; 71 scoped_refptr<TrackedCallback> accept_callback_;
76 72
77 PP_Resource* tcp_socket_buffer_; 73 PP_Resource* tcp_socket_buffer_;
78 74
79 DISALLOW_COPY_AND_ASSIGN(PPB_TCPServerSocket_Shared); 75 DISALLOW_COPY_AND_ASSIGN(PPB_TCPServerSocket_Shared);
80 }; 76 };
81 77
82 } // namespace ppapi 78 } // namespace ppapi
83 79
84 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_ 80 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_TCP_SERVER_SOCKET_SHARED_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/api_id.h ('k') | ppapi/shared_impl/private/ppb_tcp_server_socket_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698