| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 5 #ifndef PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
| 6 #define PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 6 #define PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 static const int32_t kMaxSendBufferSize; | 38 static const int32_t kMaxSendBufferSize; |
| 39 // The maximum number that we allow for setting | 39 // The maximum number that we allow for setting |
| 40 // PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input | 40 // PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input |
| 41 // argument sanity check, it doesn't mean the browser guarantees to support | 41 // argument sanity check, it doesn't mean the browser guarantees to support |
| 42 // such a buffer size. | 42 // such a buffer size. |
| 43 static const int32_t kMaxReceiveBufferSize; | 43 static const int32_t kMaxReceiveBufferSize; |
| 44 | 44 |
| 45 // The maximum number of received packets that we allow instances of this | 45 // The maximum number of received packets that we allow instances of this |
| 46 // class to buffer. | 46 // class to buffer. |
| 47 static const size_t kPluginReceiveBufferSlots; | 47 static const size_t kPluginReceiveBufferSlots; |
| 48 // The maximum number of buffers that we allow instances of this class to be |
| 49 // sending before we block the plugin. |
| 50 static const size_t kPluginSendBufferSlots; |
| 48 | 51 |
| 49 protected: | 52 protected: |
| 50 UDPSocketResourceBase(Connection connection, | 53 UDPSocketResourceBase(Connection connection, |
| 51 PP_Instance instance, | 54 PP_Instance instance, |
| 52 bool private_api); | 55 bool private_api); |
| 53 virtual ~UDPSocketResourceBase(); | 56 virtual ~UDPSocketResourceBase(); |
| 54 | 57 |
| 55 int32_t SetOptionImpl(PP_UDPSocket_Option name, | 58 int32_t SetOptionImpl(PP_UDPSocket_Option name, |
| 56 const PP_Var& value, | 59 const PP_Var& value, |
| 57 bool check_bind_state, | 60 bool check_bind_state, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 113 |
| 111 // |bind_called_| is true after Bind() is called, while |bound_| is true, | 114 // |bind_called_| is true after Bind() is called, while |bound_| is true, |
| 112 // after Bind() succeeds. Bind() is an asynchronous method, so the timing | 115 // after Bind() succeeds. Bind() is an asynchronous method, so the timing |
| 113 // on which of these is set is slightly different. | 116 // on which of these is set is slightly different. |
| 114 bool bind_called_; | 117 bool bind_called_; |
| 115 bool bound_; | 118 bool bound_; |
| 116 bool closed_; | 119 bool closed_; |
| 117 | 120 |
| 118 scoped_refptr<TrackedCallback> bind_callback_; | 121 scoped_refptr<TrackedCallback> bind_callback_; |
| 119 scoped_refptr<TrackedCallback> recvfrom_callback_; | 122 scoped_refptr<TrackedCallback> recvfrom_callback_; |
| 120 scoped_refptr<TrackedCallback> sendto_callback_; | |
| 121 | 123 |
| 122 char* read_buffer_; | 124 char* read_buffer_; |
| 123 int32_t bytes_to_read_; | 125 int32_t bytes_to_read_; |
| 124 PP_Resource* recvfrom_addr_resource_; | 126 PP_Resource* recvfrom_addr_resource_; |
| 125 | 127 |
| 126 PP_NetAddress_Private recvfrom_addr_; | 128 PP_NetAddress_Private recvfrom_addr_; |
| 127 PP_NetAddress_Private bound_addr_; | 129 PP_NetAddress_Private bound_addr_; |
| 128 | 130 |
| 129 std::queue<RecvBuffer> recv_buffers_; | 131 std::queue<RecvBuffer> recv_buffers_; |
| 130 | 132 |
| 133 std::queue<scoped_refptr<TrackedCallback>> sendto_callbacks_; |
| 134 |
| 131 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); | 135 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); |
| 132 }; | 136 }; |
| 133 | 137 |
| 134 } // namespace proxy | 138 } // namespace proxy |
| 135 } // namespace ppapi | 139 } // namespace ppapi |
| 136 | 140 |
| 137 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 141 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
| OLD | NEW |