RESOLVED FIXED 201359
Abstract out WebSocketChannel message queue
https://bugs.webkit.org/show_bug.cgi?id=201359
Summary Abstract out WebSocketChannel message queue
youenn fablet
Reported 2019-08-30 15:27:16 PDT
This can be used by RTCDataChannel as well when implementing send(Blob)
Attachments
Patch (29.62 KB, patch)
2019-08-30 15:45 PDT, youenn fablet
no flags
Patch (30.15 KB, patch)
2019-08-31 00:04 PDT, youenn fablet
no flags
Patch (30.13 KB, patch)
2019-08-31 04:05 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2019-08-30 15:45:13 PDT
Alex Christensen
Comment 2 2019-08-30 16:52:36 PDT
Comment on attachment 377757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377757&action=review > Source/WebCore/ChangeLog:25 > + (WebCore::MessageQueueWithBlobs::MessageQueueWithBlobs): I think this needs a better name, like NetworkSendQueue or something. This currently looks related to WTF::MessageQueue, but it's not. > Source/WebCore/fileapi/MessageQueueWithBlobs.h:46 > + MessageQueueWithBlobs(Document&, Function<void(const String&)>&&, Function<void(const char*, size_t)>&&, Function<bool(int)>&&); I think these functions need names in the header. Why does notifyError return a bool? > Source/WebKit/WebProcess/Network/WebSocketChannel.cpp:56 > + }, [&channel](const char* data, size_t byteLength) { > + channel.sendMessage(Messages::NetworkSocketChannel::SendData { IPC::DataReference { reinterpret_cast<const uint8_t*>(data), byteLength } }, byteLength); This captures a raw pointer and uses it later. I think we should capture a strong or weak reference instead.
youenn fablet
Comment 3 2019-08-30 23:38:49 PDT
(In reply to Alex Christensen from comment #2) > Comment on attachment 377757 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=377757&action=review > > > Source/WebCore/ChangeLog:25 > > + (WebCore::MessageQueueWithBlobs::MessageQueueWithBlobs): > > I think this needs a better name, like NetworkSendQueue or something. This > currently looks related to WTF::MessageQueue, but it's not. OK. > > Source/WebCore/fileapi/MessageQueueWithBlobs.h:46 > > + MessageQueueWithBlobs(Document&, Function<void(const String&)>&&, Function<void(const char*, size_t)>&&, Function<bool(int)>&&); > > I think these functions need names in the header. Why does notifyError > return a bool? Will add names, notifyError returns a boolean to determine whether processing messages should stop after an error or not. I will change it to processError. > > Source/WebKit/WebProcess/Network/WebSocketChannel.cpp:56 > > + }, [&channel](const char* data, size_t byteLength) { > > + channel.sendMessage(Messages::NetworkSocketChannel::SendData { IPC::DataReference { reinterpret_cast<const uint8_t*>(data), byteLength } }, byteLength); > > This captures a raw pointer and uses it later. I think we should capture a > strong or weak reference instead. channel is owning the MessageQueueWithBlobs so the lambdas will be destroyed at channel destruction time. The only tricky part is the case of the lambdas being called during the destruction of channel. I believe this is handled by the ABORT_ERROR check.
youenn fablet
Comment 4 2019-08-31 00:04:31 PDT
youenn fablet
Comment 5 2019-08-31 04:05:23 PDT
WebKit Commit Bot
Comment 6 2019-09-04 09:47:01 PDT
Comment on attachment 377796 [details] Patch Clearing flags on attachment: 377796 Committed r249481: <https://trac.webkit.org/changeset/249481>
WebKit Commit Bot
Comment 7 2019-09-04 09:47:03 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-09-04 09:48:19 PDT
Note You need to log in before you can comment on or make changes to this bug.