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_UDP_SOCKET_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 PepperUDPSocketMessageFilter(BrowserPpapiHostImpl* host, | 49 PepperUDPSocketMessageFilter(BrowserPpapiHostImpl* host, |
50 PP_Instance instance, | 50 PP_Instance instance, |
51 bool private_api); | 51 bool private_api); |
52 | 52 |
53 static size_t GetNumInstances(); | 53 static size_t GetNumInstances(); |
54 | 54 |
55 protected: | 55 protected: |
56 ~PepperUDPSocketMessageFilter() override; | 56 ~PepperUDPSocketMessageFilter() override; |
57 | 57 |
58 private: | 58 private: |
59 enum SocketOption { | |
60 SOCKET_OPTION_ADDRESS_REUSE = 1 << 0, | |
61 SOCKET_OPTION_BROADCAST = 1 << 1, | |
62 SOCKET_OPTION_RCVBUF_SIZE = 1 << 2, | |
63 SOCKET_OPTION_SNDBUF_SIZE = 1 << 3 | |
64 }; | |
65 | |
59 // ppapi::host::ResourceMessageFilter overrides. | 66 // ppapi::host::ResourceMessageFilter overrides. |
60 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( | 67 scoped_refptr<base::TaskRunner> OverrideTaskRunnerForMessage( |
61 const IPC::Message& message) override; | 68 const IPC::Message& message) override; |
62 int32_t OnResourceMessageReceived( | 69 int32_t OnResourceMessageReceived( |
63 const IPC::Message& msg, | 70 const IPC::Message& msg, |
64 ppapi::host::HostMessageContext* context) override; | 71 ppapi::host::HostMessageContext* context) override; |
65 | 72 |
66 int32_t OnMsgSetOption(const ppapi::host::HostMessageContext* context, | 73 int32_t OnMsgSetOption(const ppapi::host::HostMessageContext* context, |
67 PP_UDPSocket_Option name, | 74 PP_UDPSocket_Option name, |
68 const ppapi::SocketOptionData& value); | 75 const ppapi::SocketOptionData& value); |
(...skipping 27 matching lines...) Expand all Loading... | |
96 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, | 103 void SendSendToReply(const ppapi::host::ReplyMessageContext& context, |
97 int32_t result, | 104 int32_t result, |
98 int32_t bytes_written); | 105 int32_t bytes_written); |
99 | 106 |
100 void SendBindError(const ppapi::host::ReplyMessageContext& context, | 107 void SendBindError(const ppapi::host::ReplyMessageContext& context, |
101 int32_t result); | 108 int32_t result); |
102 void SendRecvFromError(int32_t result); | 109 void SendRecvFromError(int32_t result); |
103 void SendSendToError(const ppapi::host::ReplyMessageContext& context, | 110 void SendSendToError(const ppapi::host::ReplyMessageContext& context, |
104 int32_t result); | 111 int32_t result); |
105 | 112 |
106 bool allow_address_reuse_; | 113 // Bitwise-or of SocketOption, which is set before Bind(). |
bbudge
2014/11/07 17:50:39
To make the comment a little clearer, how about th
hidehiko
2014/11/07 21:13:55
Done.
| |
107 bool allow_broadcast_; | 114 int socket_options_; |
115 int32 rcvbuf_size_; | |
116 int32 sndbuf_size_; | |
108 | 117 |
109 scoped_ptr<net::UDPServerSocket> socket_; | 118 scoped_ptr<net::UDPServerSocket> socket_; |
110 bool closed_; | 119 bool closed_; |
111 | 120 |
112 scoped_refptr<net::IOBuffer> recvfrom_buffer_; | 121 scoped_refptr<net::IOBuffer> recvfrom_buffer_; |
113 scoped_refptr<net::IOBufferWithSize> sendto_buffer_; | 122 scoped_refptr<net::IOBufferWithSize> sendto_buffer_; |
114 | 123 |
115 net::IPEndPoint recvfrom_address_; | 124 net::IPEndPoint recvfrom_address_; |
116 | 125 |
117 size_t remaining_recv_slots_; | 126 size_t remaining_recv_slots_; |
118 | 127 |
119 bool external_plugin_; | 128 bool external_plugin_; |
120 bool private_api_; | 129 bool private_api_; |
121 | 130 |
122 int render_process_id_; | 131 int render_process_id_; |
123 int render_frame_id_; | 132 int render_frame_id_; |
124 | 133 |
125 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); | 134 DISALLOW_COPY_AND_ASSIGN(PepperUDPSocketMessageFilter); |
126 }; | 135 }; |
127 | 136 |
128 } // namespace content | 137 } // namespace content |
129 | 138 |
130 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER _H_ | 139 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_UDP_SOCKET_MESSAGE_FILTER _H_ |
OLD | NEW |