| 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(NotShared<DOMArrayBufferView> array_buffer_view, | 480 void DOMWebSocket::send(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.View(); | 483 << array_buffer_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.View()->byteLength()); | 490 UpdateBufferedAmountAfterClose(array_buffer_view->byteLength()); |
| 491 return; | 491 return; |
| 492 } | 492 } |
| 493 RecordSendTypeHistogram(kWebSocketSendTypeArrayBufferView); | 493 RecordSendTypeHistogram(kWebSocketSendTypeArrayBufferView); |
| 494 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBufferView, | 494 RecordSendMessageSizeHistogram(kWebSocketSendTypeArrayBufferView, |
| 495 array_buffer_view.View()->byteLength()); | 495 array_buffer_view->byteLength()); |
| 496 DCHECK(channel_); | 496 DCHECK(channel_); |
| 497 buffered_amount_ += array_buffer_view.View()->byteLength(); | 497 buffered_amount_ += array_buffer_view->byteLength(); |
| 498 channel_->Send(*array_buffer_view.View()->buffer(), | 498 channel_->Send(*array_buffer_view->buffer(), array_buffer_view->byteOffset(), |
| 499 array_buffer_view.View()->byteOffset(), | 499 array_buffer_view->byteLength()); |
| 500 array_buffer_view.View()->byteLength()); | |
| 501 } | 500 } |
| 502 | 501 |
| 503 void DOMWebSocket::send(Blob* binary_data, ExceptionState& exception_state) { | 502 void DOMWebSocket::send(Blob* binary_data, ExceptionState& exception_state) { |
| 504 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob " | 503 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob " |
| 505 << binary_data->Uuid(); | 504 << binary_data->Uuid(); |
| 506 DCHECK(binary_data); | 505 DCHECK(binary_data); |
| 507 if (state_ == kConnecting) { | 506 if (state_ == kConnecting) { |
| 508 SetInvalidStateErrorForSendMethod(exception_state); | 507 SetInvalidStateErrorForSendMethod(exception_state); |
| 509 return; | 508 return; |
| 510 } | 509 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 865 |
| 867 DEFINE_TRACE(DOMWebSocket) { | 866 DEFINE_TRACE(DOMWebSocket) { |
| 868 visitor->Trace(channel_); | 867 visitor->Trace(channel_); |
| 869 visitor->Trace(event_queue_); | 868 visitor->Trace(event_queue_); |
| 870 WebSocketChannelClient::Trace(visitor); | 869 WebSocketChannelClient::Trace(visitor); |
| 871 EventTargetWithInlineData::Trace(visitor); | 870 EventTargetWithInlineData::Trace(visitor); |
| 872 SuspendableObject::Trace(visitor); | 871 SuspendableObject::Trace(visitor); |
| 873 } | 872 } |
| 874 | 873 |
| 875 } // namespace blink | 874 } // namespace blink |
| OLD | NEW |