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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 | 56 |
57 // Used for creating already connected sockets. | 57 // Used for creating already connected sockets. |
58 PepperTCPSocketMessageFilter(BrowserPpapiHostImpl* host, | 58 PepperTCPSocketMessageFilter(BrowserPpapiHostImpl* host, |
59 PP_Instance instance, | 59 PP_Instance instance, |
60 ppapi::TCPSocketVersion version, | 60 ppapi::TCPSocketVersion version, |
61 scoped_ptr<net::TCPSocket> socket); | 61 scoped_ptr<net::TCPSocket> socket); |
62 | 62 |
63 static size_t GetNumInstances(); | 63 static size_t GetNumInstances(); |
64 | 64 |
65 private: | 65 private: |
66 enum SocketOptions { | |
67 SOCKET_OPTION_NODELAY = 1 << 0, | |
68 SOCKET_OPTION_RCVBUF_SIZE = 1 << 1, | |
69 SOCKET_OPTION_SNDBUF_SIZE = 1 << 2 | |
70 }; | |
71 | |
66 ~PepperTCPSocketMessageFilter() override; | 72 ~PepperTCPSocketMessageFilter() override; |
67 | 73 |
68 // ppapi::host::ResourceMessageFilter overrides. | 74 // ppapi::host::ResourceMessageFilter overrides. |
69 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( | 75 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( |
70 const IPC::Message& message) override; | 76 const IPC::Message& message) override; |
71 int32_t OnResourceMessageReceived( | 77 int32_t OnResourceMessageReceived( |
72 const IPC::Message& msg, | 78 const IPC::Message& msg, |
73 ppapi::host::HostMessageContext* context) override; | 79 ppapi::host::HostMessageContext* context) override; |
74 | 80 |
75 int32_t OnMsgBind(const ppapi::host::HostMessageContext* context, | 81 int32_t OnMsgBind(const ppapi::host::HostMessageContext* context, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 ppapi::TCPSocketState state_; | 184 ppapi::TCPSocketState state_; |
179 bool end_of_file_reached_; | 185 bool end_of_file_reached_; |
180 | 186 |
181 // This is the address requested to bind. Please note that this is not the | 187 // This is the address requested to bind. Please note that this is not the |
182 // bound address. For example, |bind_input_addr_| may have port set to 0. | 188 // bound address. For example, |bind_input_addr_| may have port set to 0. |
183 // It is used to check permission for listening. | 189 // It is used to check permission for listening. |
184 PP_NetAddress_Private bind_input_addr_; | 190 PP_NetAddress_Private bind_input_addr_; |
185 | 191 |
186 scoped_ptr<net::SingleRequestHostResolver> resolver_; | 192 scoped_ptr<net::SingleRequestHostResolver> resolver_; |
187 | 193 |
194 // Bitwise-or of SocketOption flags. This stores the state about whether | |
195 // each option is set. | |
196 int socket_options_; | |
197 | |
198 // Receive/Send buffer sizes which is set before connect(). | |
jar (doing other things)
2014/11/04 22:51:09
This code actually sets this value whether called
hidehiko
2014/11/05 12:48:29
As we do not take care about "default" value here,
| |
199 int32_t rcvbuf_size_; | |
200 int32_t sndbuf_size_; | |
201 | |
188 // |address_list_| may store multiple addresses when | 202 // |address_list_| may store multiple addresses when |
189 // PPB_TCPSocket_Private.Connect() is used, which involves name resolution. | 203 // PPB_TCPSocket_Private.Connect() is used, which involves name resolution. |
190 // In that case, we will try each address in the list until a connection is | 204 // In that case, we will try each address in the list until a connection is |
191 // successfully established. | 205 // successfully established. |
192 net::AddressList address_list_; | 206 net::AddressList address_list_; |
193 // Where we are in the above list. | 207 // Where we are in the above list. |
194 size_t address_index_; | 208 size_t address_index_; |
195 | 209 |
196 // Non-null unless an SSL connection is requested. | 210 // Non-null unless an SSL connection is requested. |
197 scoped_ptr<net::TCPSocket> socket_; | 211 scoped_ptr<net::TCPSocket> socket_; |
(...skipping 13 matching lines...) Expand all Loading... | |
211 bool pending_accept_; | 225 bool pending_accept_; |
212 scoped_ptr<net::TCPSocket> accepted_socket_; | 226 scoped_ptr<net::TCPSocket> accepted_socket_; |
213 net::IPEndPoint accepted_address_; | 227 net::IPEndPoint accepted_address_; |
214 | 228 |
215 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocketMessageFilter); | 229 DISALLOW_COPY_AND_ASSIGN(PepperTCPSocketMessageFilter); |
216 }; | 230 }; |
217 | 231 |
218 } // namespace content | 232 } // namespace content |
219 | 233 |
220 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER _H_ | 234 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_TCP_SOCKET_MESSAGE_FILTER _H_ |
OLD | NEW |