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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 static const size_t kPluginReceiveBufferSlots; | 47 static const size_t kPluginReceiveBufferSlots; |
48 | 48 |
49 protected: | 49 protected: |
50 UDPSocketResourceBase(Connection connection, | 50 UDPSocketResourceBase(Connection connection, |
51 PP_Instance instance, | 51 PP_Instance instance, |
52 bool private_api); | 52 bool private_api); |
53 virtual ~UDPSocketResourceBase(); | 53 virtual ~UDPSocketResourceBase(); |
54 | 54 |
55 int32_t SetOptionImpl(PP_UDPSocket_Option name, | 55 int32_t SetOptionImpl(PP_UDPSocket_Option name, |
56 const PP_Var& value, | 56 const PP_Var& value, |
57 bool check_bind_state, | |
57 scoped_refptr<TrackedCallback> callback); | 58 scoped_refptr<TrackedCallback> callback); |
58 int32_t BindImpl(const PP_NetAddress_Private* addr, | 59 int32_t BindImpl(const PP_NetAddress_Private* addr, |
59 scoped_refptr<TrackedCallback> callback); | 60 scoped_refptr<TrackedCallback> callback); |
60 PP_Bool GetBoundAddressImpl(PP_NetAddress_Private* addr); | 61 PP_Bool GetBoundAddressImpl(PP_NetAddress_Private* addr); |
61 // |addr| could be NULL to indicate that an output value is not needed. | 62 // |addr| could be NULL to indicate that an output value is not needed. |
62 int32_t RecvFromImpl(char* buffer, | 63 int32_t RecvFromImpl(char* buffer, |
63 int32_t num_bytes, | 64 int32_t num_bytes, |
64 PP_Resource* addr, | 65 PP_Resource* addr, |
65 scoped_refptr<TrackedCallback> callback); | 66 scoped_refptr<TrackedCallback> callback); |
66 PP_Bool GetRecvFromAddressImpl(PP_NetAddress_Private* addr); | 67 PP_Bool GetRecvFromAddressImpl(PP_NetAddress_Private* addr); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 | 100 |
100 // Callers must ensure that |output_buffer| is big enough to store |data|. | 101 // Callers must ensure that |output_buffer| is big enough to store |data|. |
101 int32_t SetRecvFromOutput(int32_t browser_result, | 102 int32_t SetRecvFromOutput(int32_t browser_result, |
102 const std::string& data, | 103 const std::string& data, |
103 const PP_NetAddress_Private& addr, | 104 const PP_NetAddress_Private& addr, |
104 char* output_buffer, | 105 char* output_buffer, |
105 int32_t num_bytes, | 106 int32_t num_bytes, |
106 PP_Resource* output_addr); | 107 PP_Resource* output_addr); |
107 | 108 |
108 bool private_api_; | 109 bool private_api_; |
110 | |
111 // |bind_called_| holds whether the Bind() is called, while |bound_| holds | |
112 // whether Bind() is successfully done. Bind() is asynchronous method, so | |
113 // the timing on which these are set are slightly different. | |
bbudge
2014/11/07 21:39:14
Could we reword this?
111 // |bind_called_| is
hidehiko
2014/11/07 22:12:21
Done.
| |
114 bool bind_called_; | |
109 bool bound_; | 115 bool bound_; |
110 bool closed_; | 116 bool closed_; |
111 | 117 |
112 scoped_refptr<TrackedCallback> bind_callback_; | 118 scoped_refptr<TrackedCallback> bind_callback_; |
113 scoped_refptr<TrackedCallback> recvfrom_callback_; | 119 scoped_refptr<TrackedCallback> recvfrom_callback_; |
114 scoped_refptr<TrackedCallback> sendto_callback_; | 120 scoped_refptr<TrackedCallback> sendto_callback_; |
115 | 121 |
116 char* read_buffer_; | 122 char* read_buffer_; |
117 int32_t bytes_to_read_; | 123 int32_t bytes_to_read_; |
118 PP_Resource* recvfrom_addr_resource_; | 124 PP_Resource* recvfrom_addr_resource_; |
119 | 125 |
120 PP_NetAddress_Private recvfrom_addr_; | 126 PP_NetAddress_Private recvfrom_addr_; |
121 PP_NetAddress_Private bound_addr_; | 127 PP_NetAddress_Private bound_addr_; |
122 | 128 |
123 std::queue<RecvBuffer> recv_buffers_; | 129 std::queue<RecvBuffer> recv_buffers_; |
124 | 130 |
125 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); | 131 DISALLOW_COPY_AND_ASSIGN(UDPSocketResourceBase); |
126 }; | 132 }; |
127 | 133 |
128 } // namespace proxy | 134 } // namespace proxy |
129 } // namespace ppapi | 135 } // namespace ppapi |
130 | 136 |
131 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ | 137 #endif // PPAPI_PROXY_UDP_SOCKET_RESOURCE_BASE_H_ |
OLD | NEW |