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_UDP_SOCKET_PRIVATE_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ |
6 #define PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_PRIVATE_UDP_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_udp_socket_private_api.h" | 13 #include "ppapi/thunk/ppb_udp_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_UDPSocket_Private. The functions that actually send messages | 18 // PPB_UDPSocket_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 UDPSocketPrivateImpl | 21 class PPAPI_SHARED_EXPORT UDPSocketPrivateImpl |
21 : public thunk::PPB_UDPSocket_Private_API, | 22 : public thunk::PPB_UDPSocket_Private_API, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Send functions that need to be implemented differently for | 62 // Send functions that need to be implemented differently for |
62 // the proxied and non-proxied derived classes. | 63 // the proxied and non-proxied derived classes. |
63 virtual void SendBind(const PP_NetAddress_Private& addr) = 0; | 64 virtual void SendBind(const PP_NetAddress_Private& addr) = 0; |
64 virtual void SendRecvFrom(int32_t num_bytes) = 0; | 65 virtual void SendRecvFrom(int32_t num_bytes) = 0; |
65 virtual void SendSendTo(const std::string& buffer, | 66 virtual void SendSendTo(const std::string& buffer, |
66 const PP_NetAddress_Private& addr) = 0; | 67 const PP_NetAddress_Private& addr) = 0; |
67 virtual void SendClose() = 0; | 68 virtual void SendClose() = 0; |
68 | 69 |
69 protected: | 70 protected: |
70 void Init(uint32 socket_id); | 71 void Init(uint32 socket_id); |
71 void PostAbortAndClearIfNecessary(PP_CompletionCallback* callback); | 72 void PostAbortIfNecessary(scoped_refptr<TrackedCallback>* callback); |
72 | 73 |
73 uint32 socket_id_; | 74 uint32 socket_id_; |
74 | 75 |
75 bool bound_; | 76 bool bound_; |
76 bool closed_; | 77 bool closed_; |
77 | 78 |
78 PP_CompletionCallback bind_callback_; | 79 scoped_refptr<TrackedCallback> bind_callback_; |
79 PP_CompletionCallback recvfrom_callback_; | 80 scoped_refptr<TrackedCallback> recvfrom_callback_; |
80 PP_CompletionCallback sendto_callback_; | 81 scoped_refptr<TrackedCallback> sendto_callback_; |
81 | 82 |
82 char* read_buffer_; | 83 char* read_buffer_; |
83 int32_t bytes_to_read_; | 84 int32_t bytes_to_read_; |
84 | 85 |
85 PP_NetAddress_Private recvfrom_addr_; | 86 PP_NetAddress_Private recvfrom_addr_; |
86 | 87 |
87 DISALLOW_COPY_AND_ASSIGN(UDPSocketPrivateImpl); | 88 DISALLOW_COPY_AND_ASSIGN(UDPSocketPrivateImpl); |
88 }; | 89 }; |
89 | 90 |
90 } // namespace ppapi | 91 } // namespace ppapi |
91 | 92 |
92 #endif // PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ | 93 #endif // PPAPI_SHARED_IMPL_PRIVATE_UDP_SOCKET_PRIVATE_IMPL_H_ |
OLD | NEW |