Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: ppapi/proxy/udp_socket_resource_base.h

Issue 690903002: Remove timing limitation of SetOption invocation for PPAPI sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/udp_socket_resource.cc ('k') | ppapi/proxy/udp_socket_resource_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_| is true after Bind() is called, while |bound_| is true,
112 // after Bind() succeeds. Bind() is an asynchronous method, so the timing
113 // on which of these is set is slightly different.
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_
OLDNEW
« no previous file with comments | « ppapi/proxy/udp_socket_resource.cc ('k') | ppapi/proxy/udp_socket_resource_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698