Drop [UsePointersEvenForNonNullableObjectArguments] from WebSocket
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Apr 2016 12:37:43 +0000 (12:37 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Apr 2016 12:37:43 +0000 (12:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156897

Reviewed by Chris Dumez.

No change of behavior.

Updating WebSocket::send methods to take references, except for ArrayBufferView, which is not yet supported by the binding generator.

* Modules/websockets/WebSocket.cpp:
(WebCore::WebSocket::send):
* Modules/websockets/WebSocket.h:
* Modules/websockets/WebSocket.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199961 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/Modules/websockets/WebSocket.h
Source/WebCore/Modules/websockets/WebSocket.idl

index 2db8abf..a2f0c94 100644 (file)
@@ -1,3 +1,19 @@
+2016-04-24  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        Drop [UsePointersEvenForNonNullableObjectArguments] from WebSocket
+        https://bugs.webkit.org/show_bug.cgi?id=156897
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior.
+
+        Updating WebSocket::send methods to take references, except for ArrayBufferView, which is not yet supported by the binding generator.
+
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::WebSocket::send):
+        * Modules/websockets/WebSocket.h:
+        * Modules/websockets/WebSocket.idl:
+
 2016-04-23  Andy Estes  <aestes@apple.com>
 
         Fix issues found by the clang static analyzer
index 38216a6..b18f27d 100644 (file)
@@ -322,22 +322,21 @@ void WebSocket::send(const String& message, ExceptionCode& ec)
     }
 }
 
-void WebSocket::send(ArrayBuffer* binaryData, ExceptionCode& ec)
+void WebSocket::send(ArrayBuffer& binaryData, ExceptionCode& ec)
 {
-    LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData);
-    ASSERT(binaryData);
+    LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, &binaryData);
     if (m_state == CONNECTING) {
         ec = INVALID_STATE_ERR;
         return;
     }
     if (m_state == CLOSING || m_state == CLOSED) {
-        unsigned payloadSize = binaryData->byteLength();
+        unsigned payloadSize = binaryData.byteLength();
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
         return;
     }
     ASSERT(m_channel);
-    m_channel->send(*binaryData, 0, binaryData->byteLength());
+    m_channel->send(binaryData, 0, binaryData.byteLength());
 }
 
 void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec)
@@ -359,21 +358,21 @@ void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec)
     m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength());
 }
 
-void WebSocket::send(Blob* binaryData, ExceptionCode& ec)
+void WebSocket::send(Blob& binaryData, ExceptionCode& ec)
 {
-    LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData->url().stringCenterEllipsizedToLength().utf8().data());
+    LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData.url().stringCenterEllipsizedToLength().utf8().data());
     if (m_state == CONNECTING) {
         ec = INVALID_STATE_ERR;
         return;
     }
     if (m_state == CLOSING || m_state == CLOSED) {
-        unsigned long payloadSize = static_cast<unsigned long>(binaryData->size());
+        unsigned long payloadSize = static_cast<unsigned long>(binaryData.size());
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize);
         m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize));
         return;
     }
     ASSERT(m_channel);
-    m_channel->send(*binaryData);
+    m_channel->send(binaryData);
 }
 
 void WebSocket::close(int code, const String& reason, ExceptionCode& ec)
index 076266b..4e8be1c 100644 (file)
@@ -72,9 +72,9 @@ public:
     void connect(const String& url, const Vector<String>& protocols, ExceptionCode&);
 
     void send(const String& message, ExceptionCode&);
-    void send(JSC::ArrayBuffer*, ExceptionCode&);
+    void send(JSC::ArrayBuffer&, ExceptionCode&);
     void send(JSC::ArrayBufferView*, ExceptionCode&);
-    void send(Blob*, ExceptionCode&);
+    void send(Blob&, ExceptionCode&);
 
     void close(int code, const String& reason, ExceptionCode&);
     void close(ExceptionCode& ec) { close(WebSocketChannel::CloseEventCodeNotSpecified, String(), ec); }
index e07591e..29e6473 100644 (file)
  */
 
 [
-    Exposed=(Window,Worker),
-    EnabledAtRuntime,
-    Conditional=WEB_SOCKETS,
     ActiveDOMObject,
+    Conditional=WEB_SOCKETS,
     Constructor(DOMString url, [Default=Undefined] optional sequence<DOMString>? protocols),
     Constructor(DOMString url, DOMString protocol),
     ConstructorRaisesException,
     ConstructorCallWith=ScriptExecutionContext,
-    UsePointersEvenForNonNullableObjectArguments,
+    EnabledAtRuntime,
+    Exposed=(Window,Worker),
 ] interface WebSocket : EventTarget {
     readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons.
     readonly attribute DOMString url;