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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: remove unused checks Created 3 years, 8 months 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
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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 return; 470 return;
471 } 471 }
472 recordSendTypeHistogram(WebSocketSendTypeArrayBuffer); 472 recordSendTypeHistogram(WebSocketSendTypeArrayBuffer);
473 recordSendMessageSizeHistogram(WebSocketSendTypeArrayBuffer, 473 recordSendMessageSizeHistogram(WebSocketSendTypeArrayBuffer,
474 binaryData->byteLength()); 474 binaryData->byteLength());
475 DCHECK(m_channel); 475 DCHECK(m_channel);
476 m_bufferedAmount += binaryData->byteLength(); 476 m_bufferedAmount += binaryData->byteLength();
477 m_channel->send(*binaryData, 0, binaryData->byteLength()); 477 m_channel->send(*binaryData, 0, binaryData->byteLength());
478 } 478 }
479 479
480 void DOMWebSocket::send(DOMArrayBufferView* arrayBufferView, 480 void DOMWebSocket::send(const NotShared<DOMArrayBufferView>& arrayBufferView,
481 ExceptionState& exceptionState) { 481 ExceptionState& exceptionState) {
482 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending ArrayBufferView " 482 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending ArrayBufferView "
483 << arrayBufferView; 483 << arrayBufferView.view();
484 DCHECK(arrayBufferView); 484 DCHECK(arrayBufferView.view());
485 if (m_state == kConnecting) { 485 if (m_state == kConnecting) {
486 setInvalidStateErrorForSendMethod(exceptionState); 486 setInvalidStateErrorForSendMethod(exceptionState);
487 return; 487 return;
488 } 488 }
489 if (m_state == kClosing || m_state == kClosed) { 489 if (m_state == kClosing || m_state == kClosed) {
490 updateBufferedAmountAfterClose(arrayBufferView->byteLength()); 490 updateBufferedAmountAfterClose(arrayBufferView.view()->byteLength());
491 return; 491 return;
492 } 492 }
493 recordSendTypeHistogram(WebSocketSendTypeArrayBufferView); 493 recordSendTypeHistogram(WebSocketSendTypeArrayBufferView);
494 recordSendMessageSizeHistogram(WebSocketSendTypeArrayBufferView, 494 recordSendMessageSizeHistogram(WebSocketSendTypeArrayBufferView,
495 arrayBufferView->byteLength()); 495 arrayBufferView.view()->byteLength());
496 DCHECK(m_channel); 496 DCHECK(m_channel);
497 m_bufferedAmount += arrayBufferView->byteLength(); 497 m_bufferedAmount += arrayBufferView.view()->byteLength();
498 m_channel->send(*arrayBufferView->buffer(), arrayBufferView->byteOffset(), 498 m_channel->send(*arrayBufferView.view()->buffer(),
499 arrayBufferView->byteLength()); 499 arrayBufferView.view()->byteOffset(),
500 arrayBufferView.view()->byteLength());
500 } 501 }
501 502
502 void DOMWebSocket::send(Blob* binaryData, ExceptionState& exceptionState) { 503 void DOMWebSocket::send(Blob* binaryData, ExceptionState& exceptionState) {
503 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob " 504 NETWORK_DVLOG(1) << "WebSocket " << this << " send() Sending Blob "
504 << binaryData->uuid(); 505 << binaryData->uuid();
505 DCHECK(binaryData); 506 DCHECK(binaryData);
506 if (m_state == kConnecting) { 507 if (m_state == kConnecting) {
507 setInvalidStateErrorForSendMethod(exceptionState); 508 setInvalidStateErrorForSendMethod(exceptionState);
508 return; 509 return;
509 } 510 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 865
865 DEFINE_TRACE(DOMWebSocket) { 866 DEFINE_TRACE(DOMWebSocket) {
866 visitor->trace(m_channel); 867 visitor->trace(m_channel);
867 visitor->trace(m_eventQueue); 868 visitor->trace(m_eventQueue);
868 WebSocketChannelClient::trace(visitor); 869 WebSocketChannelClient::trace(visitor);
869 EventTargetWithInlineData::trace(visitor); 870 EventTargetWithInlineData::trace(visitor);
870 SuspendableObject::trace(visitor); 871 SuspendableObject::trace(visitor);
871 } 872 }
872 873
873 } // namespace blink 874 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698