Chromium Code Reviews| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 | 219 |
| 220 int32_t int_value = value.value.as_int; | 220 int32_t int_value = value.value.as_int; |
| 221 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || | 221 if (value.type != PP_VARTYPE_INT32 || int_value < kMinAckDelay || |
| 222 int_value > kMaxAckDelay) { | 222 int_value > kMaxAckDelay) { |
| 223 return PP_ERROR_BADARGUMENT; | 223 return PP_ERROR_BADARGUMENT; |
| 224 } | 224 } |
| 225 config_.tcp_ack_delay_ms = int_value; | 225 config_.tcp_ack_delay_ms = int_value; |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 | 228 |
| 229 case PP_TRANSPORTPROPERTY_PORT_TYPES: { | |
| 230 if (!use_tcp_) | |
| 231 return PP_ERROR_BADARGUMENT; | |
|
Wez
2011/09/13 19:57:19
Why does this only apply to "tcp"-tyle channels?
Sergey Ulanov
2011/09/13 20:31:38
Done.
| |
| 232 | |
| 233 if (value.type != PP_VARTYPE_INT32) { | |
| 234 return PP_ERROR_BADARGUMENT; | |
| 235 } | |
| 236 | |
| 237 config_.port_types = value.value.as_int; | |
| 238 break; | |
| 239 } | |
| 240 | |
| 229 default: | 241 default: |
| 230 return PP_ERROR_BADARGUMENT; | 242 return PP_ERROR_BADARGUMENT; |
| 231 } | 243 } |
| 232 | 244 |
| 233 return PP_OK; | 245 return PP_OK; |
| 234 } | 246 } |
| 235 | 247 |
| 236 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { | 248 int32_t PPB_Transport_Impl::Connect(PP_CompletionCallback callback) { |
| 237 if (!p2p_transport_.get()) | 249 if (!p2p_transport_.get()) |
| 238 return PP_ERROR_FAILED; | 250 return PP_ERROR_FAILED; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 void PPB_Transport_Impl::OnWritten(int result) { | 415 void PPB_Transport_Impl::OnWritten(int result) { |
| 404 DCHECK(send_callback_.get() && !send_callback_->completed()); | 416 DCHECK(send_callback_.get() && !send_callback_->completed()); |
| 405 | 417 |
| 406 scoped_refptr<TrackedCompletionCallback> callback; | 418 scoped_refptr<TrackedCompletionCallback> callback; |
| 407 callback.swap(send_callback_); | 419 callback.swap(send_callback_); |
| 408 callback->Run(MapNetError(result)); | 420 callback->Run(MapNetError(result)); |
| 409 } | 421 } |
| 410 | 422 |
| 411 } // namespace ppapi | 423 } // namespace ppapi |
| 412 } // namespace webkit | 424 } // namespace webkit |
| OLD | NEW |