| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <queue> | 11 #include <queue> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "ppapi/c/ppb_udp_socket.h" | 16 #include "ppapi/c/ppb_udp_socket.h" |
| 17 #include "ppapi/c/private/ppb_net_address_private.h" | 17 #include "ppapi/c/private/ppb_net_address_private.h" |
| 18 #include "ppapi/proxy/plugin_resource.h" | 18 #include "ppapi/proxy/plugin_resource.h" |
| 19 #include "ppapi/proxy/ppapi_proxy_export.h" | 19 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 20 #include "ppapi/proxy/udp_socket_filter.h" | 20 #include "ppapi/proxy/udp_socket_filter.h" |
| 21 #include "ppapi/shared_impl/tracked_callback.h" | 21 #include "ppapi/shared_impl/tracked_callback.h" |
| 22 | 22 |
| 23 namespace ppapi { | 23 namespace ppapi { |
| 24 namespace proxy { | 24 namespace proxy { |
| 25 | 25 |
| 26 class ResourceMessageReplyParams; | 26 class ResourceMessageReplyParams; |
| 27 | 27 |
| 28 class PPAPI_PROXY_EXPORT UDPSocketResourceBase : public PluginResource { | 28 class PPAPI_PROXY_EXPORT UDPSocketResourceBase : public PluginResource { |
| 29 public: | |
| 30 // The maximum number of bytes that each | |
| 31 // PpapiPluginMsg_PPBUDPSocket_PushRecvResult message is allowed to carry. | |
| 32 static const int32_t kMaxReadSize; | |
| 33 // The maximum number of bytes that each PpapiHostMsg_PPBUDPSocket_SendTo | |
| 34 // message is allowed to carry. | |
| 35 static const int32_t kMaxWriteSize; | |
| 36 | |
| 37 // The maximum number that we allow for setting | |
| 38 // PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE. This number is only for input | |
| 39 // argument sanity check, it doesn't mean the browser guarantees to support | |
| 40 // such a buffer size. | |
| 41 static const int32_t kMaxSendBufferSize; | |
| 42 // The maximum number that we allow for setting | |
| 43 // PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE. This number is only for input | |
| 44 // argument sanity check, it doesn't mean the browser guarantees to support | |
| 45 // such a buffer size. | |
| 46 static const int32_t kMaxReceiveBufferSize; | |
| 47 | |
| 48 // The maximum number of received packets that we allow instances of this | |
| 49 // class to buffer. | |
| 50 static const size_t kPluginReceiveBufferSlots; | |
| 51 // The maximum number of buffers that we allow instances of this class to be | |
| 52 // sending before we block the plugin. | |
| 53 static const size_t kPluginSendBufferSlots; | |
| 54 | |
| 55 protected: | 29 protected: |
| 56 UDPSocketResourceBase(Connection connection, | 30 UDPSocketResourceBase(Connection connection, |
| 57 PP_Instance instance, | 31 PP_Instance instance, |
| 58 bool private_api); | 32 bool private_api); |
| 59 virtual ~UDPSocketResourceBase(); | 33 virtual ~UDPSocketResourceBase(); |
| 60 | 34 |
| 61 int32_t SetOptionImpl(PP_UDPSocket_Option name, | 35 int32_t SetOptionImpl(PP_UDPSocket_Option name, |
| 62 const PP_Var& value, | 36 const PP_Var& value, |
| 63 bool check_bind_state, | 37 bool check_bind_state, |
| 64 scoped_refptr<TrackedCallback> callback); | 38 scoped_refptr<TrackedCallback> callback); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 83 |
| 110 std::queue<scoped_refptr<TrackedCallback>> sendto_callbacks_; | 84 std::queue<scoped_refptr<TrackedCallback>> sendto_callbacks_; |
| 111 | 85 |
| 112 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); | 86 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); |
| 113 }; | 87 }; |
| 114 | 88 |
| 115 } // namespace proxy | 89 } // namespace proxy |
| 116 } // namespace ppapi | 90 } // namespace ppapi |
| 117 | 91 |
| 118 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 92 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
| OLD | NEW |