WebKit Bugzilla
Attachment 373011 Details for
Bug 199262
: WebSockets: avoid data copies when queuing tasks in WebSocketChannel
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
wk2-websockets-data-copy.diff (text/plain), 5.55 KB, created by
Carlos Garcia Campos
on 2019-06-27 02:07:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2019-06-27 02:07:01 PDT
Size:
5.55 KB
patch
obsolete
>diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3c315d4d081..dcdda07e6b1 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2019-06-27 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ WebSockets: avoid data copies when queuing tasks in WebSocketChannel >+ https://bugs.webkit.org/show_bug.cgi?id=199262 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ For IPC message handler arguments we can receive rvalue references instead of const references. >+ >+ * WebProcess/Network/WebSocketChannel.cpp: >+ (WebKit::WebSocketChannel::didConnect): >+ (WebKit::WebSocketChannel::didReceiveText): >+ (WebKit::WebSocketChannel::didReceiveBinaryData): >+ (WebKit::WebSocketChannel::didClose): >+ (WebKit::WebSocketChannel::didReceiveMessageError): >+ * WebProcess/Network/WebSocketChannel.h: >+ > 2019-06-27 Carlos Garcia Campos <cgarcia@igalia.com> > > [SOUP] WebSockets: handle TLS certificate and errors >diff --git a/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp b/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp >index 72f7d9c60f2..56cb7b8941d 100644 >--- a/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp >+++ b/Source/WebKit/WebProcess/Network/WebSocketChannel.cpp >@@ -161,7 +161,7 @@ void WebSocketChannel::disconnect() > MessageSender::send(Messages::NetworkSocketChannel::Close { 0, { } }); > } > >-void WebSocketChannel::didConnect(const String& subprotocol) >+void WebSocketChannel::didConnect(String&& subprotocol) > { > if (m_isClosing) > return; >@@ -170,17 +170,17 @@ void WebSocketChannel::didConnect(const String& subprotocol) > return; > > if (m_isSuspended) { >- enqueueTask([this, subprotocol] { >- didConnect(subprotocol); >+ enqueueTask([this, subprotocol = WTFMove(subprotocol)] () mutable { >+ didConnect(WTFMove(subprotocol)); > }); > return; > } > >- m_subprotocol = subprotocol; >+ m_subprotocol = WTFMove(subprotocol); > m_client->didConnect(); > } > >-void WebSocketChannel::didReceiveText(const String& message) >+void WebSocketChannel::didReceiveText(String&& message) > { > if (m_isClosing) > return; >@@ -189,8 +189,8 @@ void WebSocketChannel::didReceiveText(const String& message) > return; > > if (m_isSuspended) { >- enqueueTask([this, message] { >- didReceiveText(message); >+ enqueueTask([this, message = WTFMove(message)] () mutable { >+ didReceiveText(WTFMove(message)); > }); > return; > } >@@ -198,7 +198,7 @@ void WebSocketChannel::didReceiveText(const String& message) > m_client->didReceiveMessage(message); > } > >-void WebSocketChannel::didReceiveBinaryData(const IPC::DataReference& data) >+void WebSocketChannel::didReceiveBinaryData(IPC::DataReference&& data) > { > if (m_isClosing) > return; >@@ -207,7 +207,7 @@ void WebSocketChannel::didReceiveBinaryData(const IPC::DataReference& data) > return; > > if (m_isSuspended) { >- enqueueTask([this, data = data.vector()]() mutable { >+ enqueueTask([this, data = data.vector()] () mutable { > if (!m_isClosing && m_client) > m_client->didReceiveBinaryData(WTFMove(data)); > }); >@@ -216,14 +216,14 @@ void WebSocketChannel::didReceiveBinaryData(const IPC::DataReference& data) > m_client->didReceiveBinaryData(data.vector()); > } > >-void WebSocketChannel::didClose(unsigned short code, const String& reason) >+void WebSocketChannel::didClose(unsigned short code, String&& reason) > { > if (!m_client) > return; > > if (m_isSuspended) { >- enqueueTask([this, code, reason] { >- didClose(code, reason); >+ enqueueTask([this, code, reason = WTFMove(reason)] () mutable { >+ didClose(code, WTFMove(reason)); > }); > return; > } >@@ -234,14 +234,14 @@ void WebSocketChannel::didClose(unsigned short code, const String& reason) > m_client->didClose(m_bufferedAmount, (m_isClosing || code == WebCore::WebSocketChannel::CloseEventCodeNormalClosure) ? WebCore::WebSocketChannelClient::ClosingHandshakeComplete : WebCore::WebSocketChannelClient::ClosingHandshakeIncomplete, code, reason); > } > >-void WebSocketChannel::didReceiveMessageError(const String& errorMessage) >+void WebSocketChannel::didReceiveMessageError(String&& errorMessage) > { > if (!m_client) > return; > > if (m_isSuspended) { >- enqueueTask([this, errorMessage] { >- didReceiveMessageError(errorMessage); >+ enqueueTask([this, errorMessage = WTFMove(errorMessage)] () mutable { >+ didReceiveMessageError(WTFMove(errorMessage)); > }); > return; > } >diff --git a/Source/WebKit/WebProcess/Network/WebSocketChannel.h b/Source/WebKit/WebProcess/Network/WebSocketChannel.h >index 1b4a552835a..9937df17223 100644 >--- a/Source/WebKit/WebProcess/Network/WebSocketChannel.h >+++ b/Source/WebKit/WebProcess/Network/WebSocketChannel.h >@@ -73,11 +73,11 @@ private: > void derefThreadableWebSocketChannel() final { deref(); } > > // Message receivers >- void didConnect(const String&); >- void didReceiveText(const String&); >- void didReceiveBinaryData(const IPC::DataReference&); >- void didClose(unsigned short code, const String&); >- void didReceiveMessageError(const String&); >+ void didConnect(String&&); >+ void didReceiveText(String&&); >+ void didReceiveBinaryData(IPC::DataReference&&); >+ void didClose(unsigned short code, String&&); >+ void didReceiveMessageError(String&&); > > // MessageSender > IPC::Connection* messageSenderConnection() const final;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199262
: 373011