OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return; | 470 return; |
471 } | 471 } |
472 RecordSendTypeHistogram(kWebSocketSendTypeArrayBuffer); | 472 RecordSendTypeHistogram(kWebSocketSendTypeArrayBuffer); |
473 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBuffer, | 473 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBuffer, |
474 binary_data->ByteLength()); | 474 binary_data->ByteLength()); |
475 DCHECK(channel_); | 475 DCHECK(channel_); |
476 buffered_amount_ += binary_data->ByteLength(); | 476 buffered_amount_ += binary_data->ByteLength(); |
477 channel_->Send(*binary_data, 0, binary_data->ByteLength()); | 477 channel_->Send(*binary_data, 0, binary_data->ByteLength()); |
478 } | 478 } |
479 | 479 |
480 void DOMWebSocket::send(DOMArrayBufferView* array_buffer_view, | 480 void DOMWebSocket::send(NotShared<DOMArrayBufferView> array_buffer_view, |
481 ExceptionState& exception_state) { | 481 ExceptionState& exception_state) { |
482 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending ArrayBufferView " | 482 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending ArrayBufferView " |
483 << array_buffer_view; | 483 << array_buffer_view.View(); |
484 DCHECK(array_buffer_view); | 484 DCHECK(array_buffer_view); |
485 if (state_ == kConnecting) { | 485 if (state_ == kConnecting) { |
486 SetInvalidStateErrorForSendMethod(exception_state); | 486 SetInvalidStateErrorForSendMethod(exception_state); |
487 return; | 487 return; |
488 } | 488 } |
489 if (state_ == kClosing || state_ == kClosed) { | 489 if (state_ == kClosing || state_ == kClosed) { |
490 UpdateBufferedAmountAfterClose(array_buffer_view->byteLength()); | 490 UpdateBufferedAmountAfterClose(array_buffer_view.View()->byteLength()); |
491 return; | 491 return; |
492 } | 492 } |
493 RecordSendTypeHistogram(kWebSocketSendTypeArrayBufferView); | 493 RecordSendTypeHistogram(kWebSocketSendTypeArrayBufferView); |
494 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBufferView, | 494 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBufferView, |
495 array_buffer_view->byteLength()); | 495 array_buffer_view.View()->byteLength()); |
496 DCHECK(channel_); | 496 DCHECK(channel_); |
497 buffered_amount_ += array_buffer_view->byteLength(); | 497 buffered_amount_ += array_buffer_view.View()->byteLength(); |
498 channel_->Send(*array_buffer_view->buffer(), array_buffer_view->byteOffset(), | 498 channel_->Send(*array_buffer_view.View()->buffer(), |
499 array_buffer_view->byteLength()); | 499 array_buffer_view.View()->byteOffset(), |
| 500 array_buffer_view.View()->byteLength()); |
500 } | 501 } |
501 | 502 |
502 void DOMWebSocket::send(Blob* binary_data, ExceptionState& exception_state) { | 503 void DOMWebSocket::send(Blob* binary_data, ExceptionState& exception_state) { |
503 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob " | 504 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob " |
504 << binary_data->Uuid(); | 505 << binary_data->Uuid(); |
505 DCHECK(binary_data); | 506 DCHECK(binary_data); |
506 if (state_ == kConnecting) { | 507 if (state_ == kConnecting) { |
507 SetInvalidStateErrorForSendMethod(exception_state); | 508 SetInvalidStateErrorForSendMethod(exception_state); |
508 return; | 509 return; |
509 } | 510 } |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 | 866 |
866 DEFINE_TRACE(DOMWebSocket) { | 867 DEFINE_TRACE(DOMWebSocket) { |
867 visitor->Trace(channel_); | 868 visitor->Trace(channel_); |
868 visitor->Trace(event_queue_); | 869 visitor->Trace(event_queue_); |
869 WebSocketChannelClient::Trace(visitor); | 870 WebSocketChannelClient::Trace(visitor); |
870 EventTargetWithInlineData::Trace(visitor); | 871 EventTargetWithInlineData::Trace(visitor); |
871 SuspendableObject::Trace(visitor); | 872 SuspendableObject::Trace(visitor); |
872 } | 873 } |
873 | 874 |
874 } // namespace blink | 875 } // namespace blink |
OLD | NEW |