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 scoped_refptr<TrackedCallback> callback); | 60 scoped_refptr<TrackedCallback> callback); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 char* output_buffer, | 107 char* output_buffer, |
105 int32_t num_bytes, | 108 int32_t num_bytes, |
106 PP_Resource* output_addr); | 109 PP_Resource* output_addr); |
107 | 110 |
108 bool private_api_; | 111 bool private_api_; |
109 bool bound_; | 112 bool bound_; |
110 bool closed_; | 113 bool closed_; |
111 | 114 |
112 scoped_refptr<TrackedCallback> bind_callback_; | 115 scoped_refptr<TrackedCallback> bind_callback_; |
113 scoped_refptr<TrackedCallback> recvfrom_callback_; | 116 scoped_refptr<TrackedCallback> recvfrom_callback_; |
114 scoped_refptr<TrackedCallback> sendto_callback_; | |
115 | 117 |
116 char* read_buffer_; | 118 char* read_buffer_; |
117 int32_t bytes_to_read_; | 119 int32_t bytes_to_read_; |
118 PP_Resource* recvfrom_addr_resource_; | 120 PP_Resource* recvfrom_addr_resource_; |
119 | 121 |
120 PP_NetAddress_Private recvfrom_addr_; | 122 PP_NetAddress_Private recvfrom_addr_; |
121 PP_NetAddress_Private bound_addr_; | 123 PP_NetAddress_Private bound_addr_; |
122 | 124 |
123 std::queue<RecvBuffer> recv_buffers_; | 125 std::queue<RecvBuffer> recv_buffers_; |
124 | 126 |
| 127 std::queue<scoped_refptr<TrackedCallback>> sendto_callbacks_; |
| 128 |
125 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); | 129 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); |
126 }; | 130 }; |
127 | 131 |
128 } // namespace proxy | 132 } // namespace proxy |
129 } // namespace ppapi | 133 } // namespace ppapi |
130 | 134 |
131 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 135 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
OLD | NEW |