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

Side by Side Diff: Source/modules/websockets/DOMWebSocket.cpp

Issue 711763002: bindings: Transition from ArrayBuffer to DOMArrayBuffer, part 2 (2nd round) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixes Win x64 build. Created 6 years, 1 month 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
« no previous file with comments | « Source/modules/serviceworkers/Body.cpp ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 setInvalidStateErrorForSendMethod(exceptionState); 399 setInvalidStateErrorForSendMethod(exceptionState);
400 return; 400 return;
401 } 401 }
402 if (m_state == CLOSING || m_state == CLOSED) { 402 if (m_state == CLOSING || m_state == CLOSED) {
403 updateBufferedAmountAfterClose(binaryData->byteLength()); 403 updateBufferedAmountAfterClose(binaryData->byteLength());
404 return; 404 return;
405 } 405 }
406 Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebS ocketSendTypeArrayBuffer, WebSocketSendTypeMax); 406 Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebS ocketSendTypeArrayBuffer, WebSocketSendTypeMax);
407 ASSERT(m_channel); 407 ASSERT(m_channel);
408 m_bufferedAmount += binaryData->byteLength(); 408 m_bufferedAmount += binaryData->byteLength();
409 m_channel->send(*binaryData->buffer(), 0, binaryData->byteLength()); 409 m_channel->send(*binaryData, 0, binaryData->byteLength());
410 } 410 }
411 411
412 void DOMWebSocket::send(DOMArrayBufferView* arrayBufferView, ExceptionState& exc eptionState) 412 void DOMWebSocket::send(DOMArrayBufferView* arrayBufferView, ExceptionState& exc eptionState)
413 { 413 {
414 WTF_LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arr ayBufferView); 414 WTF_LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arr ayBufferView);
415 ASSERT(arrayBufferView); 415 ASSERT(arrayBufferView);
416 if (m_state == CONNECTING) { 416 if (m_state == CONNECTING) {
417 setInvalidStateErrorForSendMethod(exceptionState); 417 setInvalidStateErrorForSendMethod(exceptionState);
418 return; 418 return;
419 } 419 }
420 if (m_state == CLOSING || m_state == CLOSED) { 420 if (m_state == CLOSING || m_state == CLOSED) {
421 updateBufferedAmountAfterClose(arrayBufferView->byteLength()); 421 updateBufferedAmountAfterClose(arrayBufferView->byteLength());
422 return; 422 return;
423 } 423 }
424 Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebS ocketSendTypeArrayBufferView, WebSocketSendTypeMax); 424 Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebS ocketSendTypeArrayBufferView, WebSocketSendTypeMax);
425 ASSERT(m_channel); 425 ASSERT(m_channel);
426 m_bufferedAmount += arrayBufferView->byteLength(); 426 m_bufferedAmount += arrayBufferView->byteLength();
427 RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->view()->buffer()); 427 m_channel->send(*arrayBufferView->buffer(), arrayBufferView->byteOffset(), a rrayBufferView->byteLength());
428 m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView ->byteLength());
429 } 428 }
430 429
431 void DOMWebSocket::send(Blob* binaryData, ExceptionState& exceptionState) 430 void DOMWebSocket::send(Blob* binaryData, ExceptionState& exceptionState)
432 { 431 {
433 WTF_LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData-> uuid().utf8().data()); 432 WTF_LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData-> uuid().utf8().data());
434 ASSERT(binaryData); 433 ASSERT(binaryData);
435 if (m_state == CONNECTING) { 434 if (m_state == CONNECTING) {
436 setInvalidStateErrorForSendMethod(exceptionState); 435 setInvalidStateErrorForSendMethod(exceptionState);
437 return; 436 return;
438 } 437 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 686
688 void DOMWebSocket::trace(Visitor* visitor) 687 void DOMWebSocket::trace(Visitor* visitor)
689 { 688 {
690 visitor->trace(m_channel); 689 visitor->trace(m_channel);
691 visitor->trace(m_eventQueue); 690 visitor->trace(m_eventQueue);
692 WebSocketChannelClient::trace(visitor); 691 WebSocketChannelClient::trace(visitor);
693 EventTargetWithInlineData::trace(visitor); 692 EventTargetWithInlineData::trace(visitor);
694 } 693 }
695 694
696 } // namespace blink 695 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/Body.cpp ('k') | Source/modules/websockets/DOMWebSocketTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698