OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_TCP_SOCKET_PRIVATE_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ |
6 #define PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "ppapi/shared_impl/resource.h" | 11 #include "ppapi/shared_impl/resource.h" |
| 12 #include "ppapi/shared_impl/tracked_callback.h" |
12 #include "ppapi/thunk/ppb_tcp_socket_private_api.h" | 13 #include "ppapi/thunk/ppb_tcp_socket_private_api.h" |
13 | 14 |
14 namespace ppapi { | 15 namespace ppapi { |
15 | 16 |
16 // This class provides the shared implementation of a | 17 // This class provides the shared implementation of a |
17 // PPB_TCPSocket_Private. The functions that actually send messages | 18 // PPB_TCPSocket_Private. The functions that actually send messages |
18 // to browser are implemented differently for the proxied and | 19 // to browser are implemented differently for the proxied and |
19 // non-proxied derived classes. | 20 // non-proxied derived classes. |
20 class PPAPI_SHARED_EXPORT TCPSocketPrivateImpl | 21 class PPAPI_SHARED_EXPORT TCPSocketPrivateImpl |
21 : public thunk::PPB_TCPSocket_Private_API, | 22 : public thunk::PPB_TCPSocket_Private_API, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // initiating SSL is pending). | 86 // initiating SSL is pending). |
86 CONNECTED, | 87 CONNECTED, |
87 // An SSL connection has been successfully established. | 88 // An SSL connection has been successfully established. |
88 SSL_CONNECTED, | 89 SSL_CONNECTED, |
89 // The connection has been ended. | 90 // The connection has been ended. |
90 DISCONNECTED | 91 DISCONNECTED |
91 }; | 92 }; |
92 | 93 |
93 void Init(uint32 socket_id); | 94 void Init(uint32 socket_id); |
94 bool IsConnected() const; | 95 bool IsConnected() const; |
95 void PostAbortAndClearIfNecessary(PP_CompletionCallback* callback); | 96 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); |
96 | 97 |
97 uint32 socket_id_; | 98 uint32 socket_id_; |
98 ConnectionState connection_state_; | 99 ConnectionState connection_state_; |
99 | 100 |
100 PP_CompletionCallback connect_callback_; | 101 scoped_refptr<TrackedCallback> connect_callback_; |
101 PP_CompletionCallback ssl_handshake_callback_; | 102 scoped_refptr<TrackedCallback> ssl_handshake_callback_; |
102 PP_CompletionCallback read_callback_; | 103 scoped_refptr<TrackedCallback> read_callback_; |
103 PP_CompletionCallback write_callback_; | 104 scoped_refptr<TrackedCallback> write_callback_; |
104 | 105 |
105 char* read_buffer_; | 106 char* read_buffer_; |
106 int32_t bytes_to_read_; | 107 int32_t bytes_to_read_; |
107 | 108 |
108 PP_NetAddress_Private local_addr_; | 109 PP_NetAddress_Private local_addr_; |
109 PP_NetAddress_Private remote_addr_; | 110 PP_NetAddress_Private remote_addr_; |
110 | 111 |
111 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl); | 112 DISALLOW_COPY_AND_ASSIGN(TCPSocketPrivateImpl); |
112 }; | 113 }; |
113 | 114 |
114 } // namespace ppapi | 115 } // namespace ppapi |
115 | 116 |
116 #endif // PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ | 117 #endif // PPAPI_SHARED_IMPL_PRIVATE_TCP_SOCKET_PRIVATE_IMPL_H_ |
OLD | NEW |