Diff
Modified: trunk/Source/WebCore/ChangeLog (204511 => 204512)
--- trunk/Source/WebCore/ChangeLog 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/ChangeLog 2016-08-16 17:14:42 UTC (rev 204512)
@@ -1,3 +1,45 @@
+2016-08-16 Alex Christensen <[email protected]>
+
+ Clean up WebSockets
+ https://bugs.webkit.org/show_bug.cgi?id=160889
+
+ Reviewed by Darin Adler.
+
+ We should use size_t's instead of ints for data lengths.
+ SocketStreamHandleClient is now purely virtual.
+ A few places that will need SocketStreamHandleImpls instead of SocketStreamHandles now have them.
+ This patch doesn't change behavior.
+
+ * Modules/websockets/WebSocketChannel.cpp:
+ (WebCore::WebSocketChannel::didCloseSocketStream):
+ (WebCore::WebSocketChannel::didReceiveSocketStreamData):
+ * Modules/websockets/WebSocketChannel.h:
+ * platform/network/SocketStreamHandle.cpp:
+ (WebCore::SocketStreamHandle::state):
+ (WebCore::SocketStreamHandle::send):
+ * platform/network/SocketStreamHandle.h:
+ (WebCore::SocketStreamHandle::~SocketStreamHandle):
+ (WebCore::SocketStreamHandle::bufferedAmount):
+ (WebCore::SocketStreamHandle::client): Deleted.
+ * platform/network/SocketStreamHandleClient.h:
+ (WebCore::SocketStreamHandleClient::~SocketStreamHandleClient):
+ (WebCore::SocketStreamHandleClient::didOpenSocketStream): Deleted.
+ (WebCore::SocketStreamHandleClient::didCloseSocketStream): Deleted.
+ (WebCore::SocketStreamHandleClient::didReceiveSocketStreamData): Deleted.
+ (WebCore::SocketStreamHandleClient::didUpdateBufferedAmount): Deleted.
+ (WebCore::SocketStreamHandleClient::didFailSocketStream): Deleted.
+ * platform/network/cf/SocketStreamHandleImpl.h:
+ (WebCore::SocketStreamHandleImpl::create):
+ * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
+ (WebCore::SocketStreamHandleImpl::~SocketStreamHandleImpl):
+ (WebCore::SocketStreamHandleImpl::platformSend):
+ (WebCore::SocketStreamHandleImpl::platformClose):
+ * platform/network/curl/SocketStreamHandleImpl.h:
+ (WebCore::SocketStreamHandleImpl::create):
+ * platform/network/soup/SocketStreamHandleImpl.h:
+ * platform/network/soup/SocketStreamHandleImplSoup.cpp:
+ (WebCore::SocketStreamHandleImpl::create):
+
2016-08-16 Chris Dumez <[email protected]>
Unreviewed, rolling out r204506.
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (204511 => 204512)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -308,15 +308,18 @@
deref();
}
-void WebSocketChannel::didReceiveSocketStreamData(SocketStreamHandle& handle, const char* data, int len)
+void WebSocketChannel::didReceiveSocketStreamData(SocketStreamHandle& handle, const char* data, Optional<size_t> len)
{
- LOG(Network, "WebSocketChannel %p didReceiveSocketStreamData() Received %d bytes", this, len);
+ if (len)
+ LOG(Network, "WebSocketChannel %p didReceiveSocketStreamData() Received %zu bytes", this, len.value());
+ else
+ LOG(Network, "WebSocketChannel %p didReceiveSocketStreamData() Received no bytes", this);
Ref<WebSocketChannel> protectedThis(*this); // The client can close the channel, potentially removing the last reference.
ASSERT(&handle == m_handle);
if (!m_document) {
return;
}
- if (len <= 0) {
+ if (!len || !len.value()) {
handle.disconnect();
return;
}
@@ -327,14 +330,15 @@
}
if (m_shouldDiscardReceivedData)
return;
- if (!appendToBuffer(data, len)) {
+ if (!appendToBuffer(data, len.value())) {
m_shouldDiscardReceivedData = true;
fail("Ran out of memory while receiving WebSocket data.");
return;
}
- while (!m_suspended && m_client && !m_buffer.isEmpty())
+ while (!m_suspended && m_client && !m_buffer.isEmpty()) {
if (!processBuffer())
break;
+ }
}
void WebSocketChannel::didUpdateBufferedAmount(SocketStreamHandle&, size_t bufferedAmount)
Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h (204511 => 204512)
--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -80,11 +80,11 @@
void resume() override;
// SocketStreamHandleClient functions.
- void didOpenSocketStream(SocketStreamHandle&) override;
- void didCloseSocketStream(SocketStreamHandle&) override;
- void didReceiveSocketStreamData(SocketStreamHandle&, const char*, int) override;
- void didUpdateBufferedAmount(SocketStreamHandle&, size_t bufferedAmount) override;
- void didFailSocketStream(SocketStreamHandle&, const SocketStreamError&) override;
+ void didOpenSocketStream(SocketStreamHandle&) final;
+ void didCloseSocketStream(SocketStreamHandle&) final;
+ void didReceiveSocketStreamData(SocketStreamHandle&, const char*, Optional<size_t>) final;
+ void didUpdateBufferedAmount(SocketStreamHandle&, size_t bufferedAmount) final;
+ void didFailSocketStream(SocketStreamHandle&, const SocketStreamError&) final;
enum CloseEventCode {
CloseEventCodeNotSpecified = -1,
Modified: trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp (204511 => 204512)
--- trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandle.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -49,7 +49,7 @@
return m_state;
}
-bool SocketStreamHandle::send(const char* data, int length)
+bool SocketStreamHandle::send(const char* data, size_t length)
{
if (m_state == Connecting || m_state == Closing)
return false;
@@ -62,11 +62,13 @@
m_client.didUpdateBufferedAmount(static_cast<SocketStreamHandle&>(*this), bufferedAmount());
return true;
}
- int bytesWritten = 0;
- if (m_state == Open)
- bytesWritten = platformSend(data, length);
- if (bytesWritten < 0)
- return false;
+ size_t bytesWritten = 0;
+ if (m_state == Open) {
+ if (auto result = platformSend(data, length))
+ bytesWritten = result.value();
+ else
+ return false;
+ }
if (m_buffer.size() + length - bytesWritten > bufferSize) {
// FIXME: report error to indicate that buffer has no more space.
return false;
@@ -110,10 +112,13 @@
}
bool pending;
do {
- int bytesWritten = platformSend(m_buffer.firstBlockData(), m_buffer.firstBlockSize());
- pending = bytesWritten != static_cast<int>(m_buffer.firstBlockSize());
- if (bytesWritten <= 0)
+ auto result = platformSend(m_buffer.firstBlockData(), m_buffer.firstBlockSize());
+ if (!result)
return false;
+ size_t bytesWritten = result.value();
+ if (!bytesWritten)
+ return false;
+ pending = bytesWritten != m_buffer.firstBlockSize();
ASSERT(m_buffer.size() - bytesWritten <= bufferSize);
m_buffer.consume(bytesWritten);
} while (!pending && !m_buffer.isEmpty());
Modified: trunk/Source/WebCore/platform/network/SocketStreamHandle.h (204511 => 204512)
--- trunk/Source/WebCore/platform/network/SocketStreamHandle.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandle.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -45,18 +45,16 @@
virtual ~SocketStreamHandle() { }
SocketStreamState state() const;
- bool send(const char* data, int length);
+ bool send(const char* data, size_t length);
void close(); // Disconnect after all data in buffer are sent.
void disconnect();
size_t bufferedAmount() const { return m_buffer.size(); }
- SocketStreamHandleClient& client() const { return m_client; }
-
protected:
SocketStreamHandle(const URL&, SocketStreamHandleClient&);
bool sendPendingData();
- virtual int platformSend(const char* data, int length) = 0;
+ virtual Optional<size_t> platformSend(const char* data, size_t length) = 0;
virtual void platformClose() = 0;
URL m_url;
Modified: trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h (204511 => 204512)
--- trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/SocketStreamHandleClient.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -31,6 +31,8 @@
#pragma once
+#include <wtf/Optional.h>
+
namespace WebCore {
class SocketStreamError;
@@ -40,12 +42,11 @@
public:
virtual ~SocketStreamHandleClient() { }
- virtual void didOpenSocketStream(SocketStreamHandle&) { }
- virtual void didCloseSocketStream(SocketStreamHandle&) { }
- virtual void didReceiveSocketStreamData(SocketStreamHandle&, const char* /*data*/, int /*length*/) { }
- virtual void didUpdateBufferedAmount(SocketStreamHandle&, size_t /*bufferedAmount*/) { }
-
- virtual void didFailSocketStream(SocketStreamHandle&, const SocketStreamError&) { }
+ virtual void didOpenSocketStream(SocketStreamHandle&) = 0;
+ virtual void didCloseSocketStream(SocketStreamHandle&) = 0;
+ virtual void didReceiveSocketStreamData(SocketStreamHandle&, const char* data, Optional<size_t> length) = 0;
+ virtual void didUpdateBufferedAmount(SocketStreamHandle&, size_t bufferedAmount) = 0;
+ virtual void didFailSocketStream(SocketStreamHandle&, const SocketStreamError&) = 0;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h (204511 => 204512)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -45,12 +45,12 @@
class SocketStreamHandleImpl : public SocketStreamHandle {
public:
- static Ref<SocketStreamHandle> create(const URL& url, SocketStreamHandleClient& client, SessionID sessionID) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID)); }
+ static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, SessionID sessionID) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID)); }
virtual ~SocketStreamHandleImpl();
private:
- virtual int platformSend(const char* data, int length);
+ virtual Optional<size_t> platformSend(const char* data, size_t length);
virtual void platformClose();
WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, SessionID);
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (204511 => 204512)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -536,7 +536,11 @@
if (!length)
return;
- m_client.didReceiveSocketStreamData(*this, reinterpret_cast<const char*>(ptr), length);
+ Optional<size_t> optionalLength;
+ if (length != -1)
+ optionalLength = length;
+
+ m_client.didReceiveSocketStreamData(*this, reinterpret_cast<const char*>(ptr), optionalLength);
return;
}
@@ -649,12 +653,17 @@
ASSERT(!m_pacRunLoopSource);
}
-int SocketStreamHandleImpl::platformSend(const char* data, int length)
+Optional<size_t> SocketStreamHandleImpl::platformSend(const char* data, size_t length)
{
if (!CFWriteStreamCanAcceptBytes(m_writeStream.get()))
- return 0;
+ return Nullopt;
- return CFWriteStreamWrite(m_writeStream.get(), reinterpret_cast<const UInt8*>(data), length);
+ CFIndex result = CFWriteStreamWrite(m_writeStream.get(), reinterpret_cast<const UInt8*>(data), length);
+ if (result == -1)
+ return Nullopt;
+
+ ASSERT(result >= 0);
+ return static_cast<size_t>(result);
}
void SocketStreamHandleImpl::platformClose()
Modified: trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h (204511 => 204512)
--- trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -50,7 +50,7 @@
class SocketStreamHandleImpl : public SocketStreamHandle {
public:
- static Ref<SocketStreamHandle> create(const URL& url, SocketStreamHandleClient& client, SessionID) { return adoptRef(*new SocketStreamHandleImpl(url, client)); }
+ static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, SessionID) { return adoptRef(*new SocketStreamHandleImpl(url, client)); }
virtual ~SocketStreamHandleImpl();
@@ -57,8 +57,8 @@
private:
SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&);
- int platformSend(const char* data, int length) override;
- void platformClose() override;
+ Optional<size_t> platformSend(const char* data, size_t length) final;
+ void platformClose() final;
bool readData(CURL*);
bool sendData(CURL*);
@@ -70,10 +70,10 @@
void didReceiveData();
void didOpenSocket();
- static std::unique_ptr<char[]> createCopy(const char* data, int length);
+ static std::unique_ptr<char[]> createCopy(const char* data, size_t length);
struct SocketData {
- SocketData(std::unique_ptr<char[]>&& source, int length)
+ SocketData(std::unique_ptr<char[]>&& source, size_t length)
{
data = ""
size = length;
@@ -87,7 +87,7 @@
}
std::unique_ptr<char[]> data;
- int size { 0 };
+ size_t size { 0 };
};
ThreadIdentifier m_workerThread { 0 };
Modified: trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp (204511 => 204512)
--- trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/curl/SocketStreamHandleImplCurl.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -58,7 +58,7 @@
ASSERT(!m_workerThread);
}
-int SocketStreamHandleImpl::platformSend(const char* data, int length)
+Optional<size_t> SocketStreamHandleImpl::platformSend(const char* data, size_t length)
{
LOG(Network, "SocketStreamHandle %p platformSend", this);
@@ -89,7 +89,7 @@
{
ASSERT(!isMainThread());
- const int bufferSize = 1024;
+ const size_t bufferSize = 1024;
std::unique_ptr<char[]> data(new char[bufferSize]);
size_t bytesRead = 0;
@@ -97,7 +97,7 @@
if (ret == CURLE_OK && bytesRead >= 0) {
m_mutexReceive.lock();
- m_receiveData.append(SocketData { WTFMove(data), static_cast<int>(bytesRead) });
+ m_receiveData.append(SocketData { WTFMove(data), bytesRead });
m_mutexReceive.unlock();
ref();
@@ -130,7 +130,7 @@
auto sendData = m_sendData.takeFirst();
m_mutexSend.unlock();
- int totalBytesSent = 0;
+ size_t totalBytesSent = 0;
while (totalBytesSent < sendData.size) {
size_t bytesSent = 0;
CURLcode ret = curl_easy_send(curlHandle, sendData.data.get() + totalBytesSent, sendData.size - totalBytesSent, &bytesSent);
@@ -143,7 +143,7 @@
// Insert remaining data into send queue.
if (totalBytesSent < sendData.size) {
- const int restLength = sendData.size - totalBytesSent;
+ const size_t restLength = sendData.size - totalBytesSent;
auto copy = createCopy(sendData.data.get() + totalBytesSent, restLength);
std::lock_guard<Lock> lock(m_mutexSend);
Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h (204511 => 204512)
--- trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -47,7 +47,7 @@
class SocketStreamHandleImpl final : public SocketStreamHandle {
public:
- static Ref<SocketStreamHandle> create(const URL&, SocketStreamHandleClient&, SessionID);
+ static Ref<SocketStreamHandleImpl> create(const URL&, SocketStreamHandleClient&, SessionID);
static Ref<SocketStreamHandle> create(GSocketConnection*, SocketStreamHandleClient&);
virtual ~SocketStreamHandleImpl();
@@ -55,8 +55,8 @@
private:
SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&);
- int platformSend(const char* data, int length) override;
- void platformClose() override;
+ Optional<size_t> platformSend(const char* data, size_t length) final;
+ void platformClose() final;
void beginWaitingForSocketWritability();
void stopWaitingForSocketWritability();
Modified: trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp (204511 => 204512)
--- trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -48,7 +48,7 @@
namespace WebCore {
-Ref<SocketStreamHandle> SocketStreamHandleImpl::create(const URL& url, SocketStreamHandleClient& client, SessionID)
+Ref<SocketStreamHandleImpl> SocketStreamHandleImpl::create(const URL& url, SocketStreamHandleClient& client, SessionID)
{
Ref<SocketStreamHandleImpl> socket = adoptRef(*new SocketStreamHandleImpl(url, client));
@@ -59,7 +59,7 @@
Ref<SocketStreamHandle> protectedSocketStreamHandle = socket.copyRef();
g_socket_client_connect_to_host_async(socketClient.get(), url.host().utf8().data(), port, socket->m_cancellable.get(),
reinterpret_cast<GAsyncReadyCallback>(connectedCallback), &protectedSocketStreamHandle.leakRef());
- return WTFMove(socket);
+ return socket;
}
Ref<SocketStreamHandle> SocketStreamHandleImpl::create(GSocketConnection* socketConnection, SocketStreamHandleClient& client)
@@ -128,7 +128,10 @@
// The client can close the handle, potentially removing the last reference.
RefPtr<SocketStreamHandle> protectedThis(this);
- m_client.didReceiveSocketStreamData(*this, m_readBuffer.get(), bytesRead);
+ Optional<size_t> optionalLength;
+ if (bytesRead != -1)
+ optionalLength = static_cast<size_t>(bytesRead);
+ m_client.didReceiveSocketStreamData(*this, m_readBuffer.get(), optionalLength);
if (m_inputStream) {
g_input_stream_read_async(m_inputStream.get(), m_readBuffer.get(), READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, m_cancellable.get(),
reinterpret_cast<GAsyncReadyCallback>(readReadyCallback), protectedThis.leakRef());
@@ -168,11 +171,11 @@
sendPendingData();
}
-int SocketStreamHandleImpl::platformSend(const char* data, int length)
+Optional<size_t> SocketStreamHandleImpl::platformSend(const char* data, size_t length)
{
LOG(Network, "SocketStreamHandle %p platformSend", this);
if (!m_outputStream || !data)
- return 0;
+ return Nullopt;
GUniqueOutPtr<GError> error;
gssize written = g_pollable_output_stream_write_nonblocking(m_outputStream.get(), data, length, m_cancellable.get(), &error.outPtr());
@@ -181,15 +184,18 @@
beginWaitingForSocketWritability();
else
didFail(SocketStreamError(error->code, String(), error->message));
- return 0;
+ return Nullopt;
}
// If we did not send all the bytes we were given, we know that
// SocketStreamHandle will need to send more in the future.
- if (written < length)
+ if (written == -1 || static_cast<size_t>(written) < length)
beginWaitingForSocketWritability();
- return written;
+ if (written == -1)
+ return Nullopt;
+
+ return static_cast<size_t>(written);
}
void SocketStreamHandleImpl::platformClose()
Modified: trunk/Source/WebKit2/ChangeLog (204511 => 204512)
--- trunk/Source/WebKit2/ChangeLog 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-16 17:14:42 UTC (rev 204512)
@@ -1,3 +1,15 @@
+2016-08-16 Alex Christensen <[email protected]>
+
+ Clean up WebSockets
+ https://bugs.webkit.org/show_bug.cgi?id=160889
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/InspectorServer/WebSocketServerConnection.cpp:
+ (WebKit::WebSocketServerConnection::didCloseSocketStream):
+ (WebKit::WebSocketServerConnection::didReceiveSocketStreamData):
+ * UIProcess/InspectorServer/WebSocketServerConnection.h:
+
2016-08-16 Chris Dumez <[email protected]>
Unreviewed, rolling out r204506.
Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp (204511 => 204512)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.cpp 2016-08-16 17:14:42 UTC (rev 204512)
@@ -133,11 +133,12 @@
m_server->didCloseWebSocketServerConnection(this);
}
-void WebSocketServerConnection::didReceiveSocketStreamData(SocketStreamHandle&, const char* data, int length)
+void WebSocketServerConnection::didReceiveSocketStreamData(SocketStreamHandle&, const char* data, Optional<size_t> length)
{
// Each didReceiveData call adds more data to our buffer.
// We clear the buffer when we have handled data from it.
- m_bufferedData.append(data, length);
+ if (length)
+ m_bufferedData.append(data, length.value());
switch (m_mode) {
case HTTP:
Modified: trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.h (204511 => 204512)
--- trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.h 2016-08-16 17:05:54 UTC (rev 204511)
+++ trunk/Source/WebKit2/UIProcess/InspectorServer/WebSocketServerConnection.h 2016-08-16 17:14:42 UTC (rev 204512)
@@ -24,8 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebSocketServerConnection_h
-#define WebSocketServerConnection_h
+#pragma once
#if ENABLE(INSPECTOR_SERVER)
@@ -37,6 +36,7 @@
namespace WebCore {
class HTTPHeaderMap;
+class SocketStreamError;
class SocketStreamHandle;
}
@@ -67,9 +67,11 @@
private:
// SocketStreamHandleClient implementation.
- void didCloseSocketStream(WebCore::SocketStreamHandle&) override;
- void didReceiveSocketStreamData(WebCore::SocketStreamHandle&, const char* data, int length) override;
- void didUpdateBufferedAmount(WebCore::SocketStreamHandle&, size_t bufferedAmount) override;
+ void didOpenSocketStream(WebCore::SocketStreamHandle&) final { }
+ void didCloseSocketStream(WebCore::SocketStreamHandle&) final;
+ void didReceiveSocketStreamData(WebCore::SocketStreamHandle&, const char* data, Optional<size_t> length) final;
+ void didUpdateBufferedAmount(WebCore::SocketStreamHandle&, size_t bufferedAmount) final;
+ void didFailSocketStream(WebCore::SocketStreamHandle&, const WebCore::SocketStreamError&) final { }
// HTTP Mode.
void readHTTPMessage();
@@ -91,5 +93,3 @@
}
#endif // ENABLE(INSPECTOR_SERVER)
-
-#endif // WebSocketServerConnection_h