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

Side by Side Diff: webkit/plugins/ppapi/ppb_transport_impl.cc

Issue 7888022: Add DISABLE_TCP_TRANSPORT flag in the Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/plugins/ppapi/ppb_transport_impl.h" 5 #include "webkit/plugins/ppapi/ppb_transport_impl.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 case PP_TRANSPORTRELAYMODE_GOOGLE: 171 case PP_TRANSPORTRELAYMODE_GOOGLE:
172 config_.legacy_relay = true; 172 config_.legacy_relay = true;
173 break; 173 break;
174 default: 174 default:
175 return PP_ERROR_BADARGUMENT; 175 return PP_ERROR_BADARGUMENT;
176 } 176 }
177 break; 177 break;
178 } 178 }
179 179
180 case PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW: { 180 case PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW: {
181 if (!use_tcp_)
182 return PP_ERROR_BADARGUMENT;
183
184 int32_t int_value = value.value.as_int; 181 int32_t int_value = value.value.as_int;
185 if (value.type != PP_VARTYPE_INT32 || int_value < kMinBufferSize || 182 if (value.type != PP_VARTYPE_INT32 || int_value < kMinBufferSize ||
186 int_value > kMaxBufferSize) { 183 int_value > kMaxBufferSize) {
187 return PP_ERROR_BADARGUMENT; 184 return PP_ERROR_BADARGUMENT;
188 } 185 }
189 config_.tcp_receive_window = int_value; 186 config_.tcp_receive_window = int_value;
190 break; 187 break;
191 } 188 }
192 189
193 case PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW: { 190 case PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW: {
(...skipping 25 matching lines...) Expand all
219 216
220 int32_t int_value = value.value.as_int; 217 int32_t int_value = value.value.as_int;
221 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || 218 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay ||
222 int_value > kMaxAckDelay) { 219 int_value > kMaxAckDelay) {
223 return PP_ERROR_BADARGUMENT; 220 return PP_ERROR_BADARGUMENT;
224 } 221 }
225 config_.tcp_ack_delay_ms = int_value; 222 config_.tcp_ack_delay_ms = int_value;
226 break; 223 break;
227 } 224 }
228 225
226 case PP_TRANSPORTPROPERTY_PROTOCOLS: {
227 if (!use_tcp_)
228 return PP_ERROR_BADARGUMENT;
229
230 if (value.type != PP_VARTYPE_INT32) {
231 return PP_ERROR_BADARGUMENT;
232 }
233
234 config_.protocols = value.value.as_int;
235 break;
236 }
237
229 default: 238 default:
230 return PP_ERROR_BADARGUMENT; 239 return PP_ERROR_BADARGUMENT;
231 } 240 }
232 241
233 return PP_OK; 242 return PP_OK;
234 } 243 }
235 244
236 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { 245 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) {
237 if (!p2p_transport_.get()) 246 if (!p2p_transport_.get())
238 return PP_ERROR_FAILED; 247 return PP_ERROR_FAILED;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void PPB_Transport_Impl::OnWritten(int result) { 412 void PPB_Transport_Impl::OnWritten(int result) {
404 DCHECK(send_callback_.get() && !send_callback_->completed()); 413 DCHECK(send_callback_.get() && !send_callback_->completed());
405 414
406 scoped_refptr<TrackedCompletionCallback> callback; 415 scoped_refptr<TrackedCompletionCallback> callback;
407 callback.swap(send_callback_); 416 callback.swap(send_callback_);
408 callback->Run(MapNetError(result)); 417 callback->Run(MapNetError(result));
409 } 418 }
410 419
411 } // namespace ppapi 420 } // namespace ppapi
412 } // namespace webkit 421 } // namespace webkit
OLDNEW
« content/renderer/p2p/port_allocator.cc ('K') | « webkit/glue/p2p_transport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698