| OLD | NEW |
| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 int32_t int_value = value.value.as_int; | 217 int32_t int_value = value.value.as_int; |
| 218 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || | 218 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || |
| 219 int_value > kMaxAckDelay) { | 219 int_value > kMaxAckDelay) { |
| 220 return PP_ERROR_BADARGUMENT; | 220 return PP_ERROR_BADARGUMENT; |
| 221 } | 221 } |
| 222 config_.tcp_ack_delay_ms = int_value; | 222 config_.tcp_ack_delay_ms = int_value; |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 | 225 |
| 226 case PP_TRANSPORTPROPERTY_DISABLE_TCP_TRANSPORT: { |
| 227 if (value.type != PP_VARTYPE_BOOL) |
| 228 return PP_ERROR_BADARGUMENT; |
| 229 config_.disable_tcp_transport = PP_ToBool(value.value.as_bool); |
| 230 break; |
| 231 } |
| 232 |
| 226 default: | 233 default: |
| 227 return PP_ERROR_BADARGUMENT; | 234 return PP_ERROR_BADARGUMENT; |
| 228 } | 235 } |
| 229 | 236 |
| 230 return PP_OK; | 237 return PP_OK; |
| 231 } | 238 } |
| 232 | 239 |
| 233 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { | 240 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { |
| 234 if (!p2p_transport_.get()) | 241 if (!p2p_transport_.get()) |
| 235 return PP_ERROR_FAILED; | 242 return PP_ERROR_FAILED; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 void PPB_Transport_Impl::OnWritten(int result) { | 407 void PPB_Transport_Impl::OnWritten(int result) { |
| 401 DCHECK(send_callback_.get() && !send_callback_->completed()); | 408 DCHECK(send_callback_.get() && !send_callback_->completed()); |
| 402 | 409 |
| 403 scoped_refptr<TrackedCompletionCallback> callback; | 410 scoped_refptr<TrackedCompletionCallback> callback; |
| 404 callback.swap(send_callback_); | 411 callback.swap(send_callback_); |
| 405 callback->Run(MapNetError(result)); | 412 callback->Run(MapNetError(result)); |
| 406 } | 413 } |
| 407 | 414 |
| 408 } // namespace ppapi | 415 } // namespace ppapi |
| 409 } // namespace webkit | 416 } // namespace webkit |
| OLD | NEW |