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

Issue 1568523002: Implement content::WebSocketBlobSender (Closed)

Created:
4 years, 11 months ago by Adam Rice
Modified:
4 years, 10 months ago
CC:
chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, jam, kinuko, nasko+codewatch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@websocket_blob_send_ipcs
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement content::WebSocketBlobSender Add the class WebSocketBlobSender to send Blobs over WebSockets from within the browser process. This CL also includes the necessary changes to WebSocketDispatcherHost and WebSocketHost to use the new class. Also add IPC messages WebSocketHostMsg_SendBlob and WebSocketMsg_BlobSendComplete which expose the new functionality. The renderer-side functionality is implemented in http://crrev.com/1574213003. See design doc at https://docs.google.com/document/d/1CDiXB9pBumhFVVfmIn1CRI6v6byxyqWu2urEE9xp714/edit BUG=571656 TEST=content_unittests Committed: https://crrev.com/3466ee18e0f32f37887085e3d06576286b7355b1 Cr-Commit-Position: refs/heads/master@{#374110}

Patch Set 1 #

Patch Set 2 : Add WebSocketBlobSender implementation. #

Patch Set 3 : Finish WebSocketBlobSender tests. #

Patch Set 4 : Rebase. #

Patch Set 5 : Implement SendBlob IPC on browser side. #

Patch Set 6 : Ensure WebSocketBlobSender object is deleted. #

Patch Set 7 : Use a real MessageLoopForIO #

Patch Set 8 : Handle channel deletion during SendFrame safely. #

Patch Set 9 : Add test for deleting the sender in SendFrame(). #

Patch Set 10 : Fix the case where SendFrame() increases quota synchronously. #

Patch Set 11 : Format fixes. #

Patch Set 12 : Fix bug when WebSocketBlobSender::Start causes the WebSocketHost object to be deleted synchronously. #

Patch Set 13 : Constify some things. #

Patch Set 14 : Add Do prefix to methods that are used by the WebSocketBlobSender DoLoop #

Patch Set 15 : Merge websocket_messages.h into this CL. #

Patch Set 16 : Rebase. #

Patch Set 17 : Fix memory leak in tests. #

Total comments: 12

Patch Set 18 : Make WebSocketBlobSender::State an enum class. Deal harshly with misbehaving renderers. #

Patch Set 19 : Minor fixes. #

Total comments: 8

Patch Set 20 : Changes from yhirano review. #

Patch Set 21 : Use the real net::TestCompletionCallback. #

Total comments: 8

Patch Set 22 : Add final class qualifiers and document the interaction of SendBlob IPC with FlowControl IPC. #

Total comments: 10

Patch Set 23 : Change quota type to size_t and CHECK to DCHECK. #

Patch Set 24 : clang-format fixes. #

Patch Set 25 : Add new BadMessageReasons to histograms.xml. #

Total comments: 4

Patch Set 26 : Initialise the ChromeBlobStorageContext correctly. #

Patch Set 27 : Check that |reader_| isn't initialised when Start() is called. #

Patch Set 28 : clang-format fixes to render_process_host_impl.cc #

Total comments: 4

Patch Set 29 : Rename chrome_blob_storage_context and make it a scoped_refptr. #

Patch Set 30 : Rebase. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1141 lines, -56 lines) Patch
M content/browser/bad_message.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 4 chunks +10 lines, -6 lines 0 comments Download
A content/browser/renderer_host/websocket_blob_sender.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +139 lines, -0 lines 0 comments Download
A content/browser/renderer_host/websocket_blob_sender.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +284 lines, -0 lines 0 comments Download
A content/browser/renderer_host/websocket_blob_sender_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +446 lines, -0 lines 0 comments Download
M content/browser/renderer_host/websocket_dispatcher_host.h View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +26 lines, -3 lines 0 comments Download
M content/browser/renderer_host/websocket_dispatcher_host.cc View 1 2 3 4 5 9 chunks +25 lines, -6 lines 0 comments Download
M content/browser/renderer_host/websocket_host.h View 1 2 3 4 5 4 chunks +10 lines, -0 lines 0 comments Download
M content/browser/renderer_host/websocket_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 17 chunks +163 lines, -41 lines 0 comments Download
M content/common/websocket_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +30 lines, -0 lines 2 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +1 line, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +2 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 47 (16 generated)
Adam Rice
4 years, 11 months ago (2016-01-20 06:25:21 UTC) #5
dcheng
Some random comments... I'll finish looking over the IPC handling bits tomorrow since it's a ...
4 years, 11 months ago (2016-01-20 08:30:06 UTC) #8
Adam Rice
https://codereview.chromium.org/1568523002/diff/320001/content/browser/renderer_host/websocket_blob_sender.cc File content/browser/renderer_host/websocket_blob_sender.cc (right): https://codereview.chromium.org/1568523002/diff/320001/content/browser/renderer_host/websocket_blob_sender.cc#newcode83 content/browser/renderer_host/websocket_blob_sender.cc:83: CHECK_EQ(STATE_READ_COMPLETE, next_state_); On 2016/01/20 08:30:06, dcheng wrote: > Would ...
4 years, 11 months ago (2016-01-20 17:11:21 UTC) #9
yhirano
https://codereview.chromium.org/1568523002/diff/360001/content/browser/renderer_host/websocket_blob_sender.cc File content/browser/renderer_host/websocket_blob_sender.cc (right): https://codereview.chromium.org/1568523002/diff/360001/content/browser/renderer_host/websocket_blob_sender.cc#newcode101 content/browser/renderer_host/websocket_blob_sender.cc:101: void WebSocketBlobSender::OnIOComplete(int rv) { OnReadComplete would be easier to ...
4 years, 11 months ago (2016-01-21 12:07:34 UTC) #10
Adam Rice
https://codereview.chromium.org/1568523002/diff/360001/content/browser/renderer_host/websocket_blob_sender.cc File content/browser/renderer_host/websocket_blob_sender.cc (right): https://codereview.chromium.org/1568523002/diff/360001/content/browser/renderer_host/websocket_blob_sender.cc#newcode101 content/browser/renderer_host/websocket_blob_sender.cc:101: void WebSocketBlobSender::OnIOComplete(int rv) { On 2016/01/21 12:07:34, yhirano wrote: ...
4 years, 11 months ago (2016-01-21 19:24:34 UTC) #11
yhirano
https://codereview.chromium.org/1568523002/diff/400001/content/browser/renderer_host/websocket_blob_sender.h File content/browser/renderer_host/websocket_blob_sender.h (right): https://codereview.chromium.org/1568523002/diff/400001/content/browser/renderer_host/websocket_blob_sender.h#newcode41 content/browser/renderer_host/websocket_blob_sender.h:41: class CONTENT_EXPORT WebSocketBlobSender { +final https://codereview.chromium.org/1568523002/diff/400001/content/browser/renderer_host/websocket_blob_sender_unittest.cc File content/browser/renderer_host/websocket_blob_sender_unittest.cc (right): ...
4 years, 11 months ago (2016-01-25 10:52:23 UTC) #12
Adam Rice
https://codereview.chromium.org/1568523002/diff/400001/content/browser/renderer_host/websocket_blob_sender.h File content/browser/renderer_host/websocket_blob_sender.h (right): https://codereview.chromium.org/1568523002/diff/400001/content/browser/renderer_host/websocket_blob_sender.h#newcode41 content/browser/renderer_host/websocket_blob_sender.h:41: class CONTENT_EXPORT WebSocketBlobSender { On 2016/01/25 10:52:23, yhirano wrote: ...
4 years, 11 months ago (2016-01-25 23:04:02 UTC) #13
Adam Rice
dcheng: Is there anything I can do to help your analysis? For what it's worth, ...
4 years, 11 months ago (2016-01-26 00:20:16 UTC) #14
yhirano
lgtm
4 years, 11 months ago (2016-01-26 01:13:37 UTC) #15
dcheng
At a high-level, I think this change is probably fine. My two concerns are around: ...
4 years, 11 months ago (2016-01-26 22:09:32 UTC) #16
Adam Rice
I have filed a bug crbug.com/581567 to use size_t for quota everywhere, since it's larger ...
4 years, 11 months ago (2016-01-27 01:52:57 UTC) #17
Adam Rice
dcheng: ping. Does it look okay now?
4 years, 10 months ago (2016-01-29 07:47:30 UTC) #18
dcheng
ipc changes lgtm If there are places where you'd prefer to have a checked_cast over ...
4 years, 10 months ago (2016-01-29 08:23:53 UTC) #19
Adam Rice
+dmurph, do you have time to check the use of storage::BlobReader in this CL? I ...
4 years, 10 months ago (2016-01-29 10:34:11 UTC) #21
dmurph
publishing early comments because I have to go. Yes, the reader should populate a read ...
4 years, 10 months ago (2016-02-03 01:35:36 UTC) #22
dmurph
ALSO: you cannot "reuse" the blob reader. Make sure that you class doesn't expect this, ...
4 years, 10 months ago (2016-02-03 01:43:38 UTC) #23
Adam Rice
https://codereview.chromium.org/1568523002/diff/480001/content/browser/renderer_host/render_process_host_impl.cc File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1568523002/diff/480001/content/browser/renderer_host/render_process_host_impl.cc#newcode964 content/browser/renderer_host/render_process_host_impl.cc:964: resource_message_filter->blob_storage_context(), On 2016/02/03 01:35:36, dmurph wrote: > Please use ...
4 years, 10 months ago (2016-02-03 03:04:46 UTC) #24
Adam Rice
On 2016/02/03 01:43:38, dmurph wrote: > ALSO: you cannot "reuse" the blob reader. Make sure ...
4 years, 10 months ago (2016-02-03 03:13:18 UTC) #25
dmurph
BlobReader stuff lgtm https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/websocket_dispatcher_host.cc File content/browser/renderer_host/websocket_dispatcher_host.cc (right): https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/websocket_dispatcher_host.cc#newcode142 content/browser/renderer_host/websocket_dispatcher_host.cc:142: return blob_storage_context_->context(); Just FYI, this isn't ...
4 years, 10 months ago (2016-02-03 19:30:04 UTC) #26
Adam Rice
https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/websocket_dispatcher_host.cc File content/browser/renderer_host/websocket_dispatcher_host.cc (right): https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/websocket_dispatcher_host.cc#newcode142 content/browser/renderer_host/websocket_dispatcher_host.cc:142: return blob_storage_context_->context(); On 2016/02/03 19:30:04, dmurph wrote: > Just ...
4 years, 10 months ago (2016-02-04 05:48:36 UTC) #27
Adam Rice
+asvitkine for histograms.xml. It's just an addition of two BadMessageReasons. See bad_message.h for the change.
4 years, 10 months ago (2016-02-04 05:50:47 UTC) #29
Alexei Svitkine (slow)
lgtm
4 years, 10 months ago (2016-02-04 16:20:21 UTC) #31
kinuko
https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/render_process_host_impl.cc File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/render_process_host_impl.cc#newcode876 content/browser/renderer_host/render_process_host_impl.cc:876: ChromeBlobStorageContext* chrome_blob_storage_context = nit: this class name is very ...
4 years, 10 months ago (2016-02-05 05:18:07 UTC) #33
Adam Rice
https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/render_process_host_impl.cc File content/browser/renderer_host/render_process_host_impl.cc (right): https://codereview.chromium.org/1568523002/diff/540001/content/browser/renderer_host/render_process_host_impl.cc#newcode876 content/browser/renderer_host/render_process_host_impl.cc:876: ChromeBlobStorageContext* chrome_blob_storage_context = On 2016/02/05 05:18:06, kinuko wrote: > ...
4 years, 10 months ago (2016-02-05 07:21:48 UTC) #34
Adam Rice
kinuko: This CL no longer applies cleanly against ToT. Would you like me to rebase ...
4 years, 10 months ago (2016-02-08 01:13:00 UTC) #35
kinuko
Either works for me. lgtm anyways
4 years, 10 months ago (2016-02-08 01:53:46 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1568523002/580001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1568523002/580001
4 years, 10 months ago (2016-02-08 08:59:34 UTC) #40
commit-bot: I haz the power
Committed patchset #30 (id:580001)
4 years, 10 months ago (2016-02-08 12:06:18 UTC) #42
commit-bot: I haz the power
Patchset 30 (id:??) landed as https://crrev.com/3466ee18e0f32f37887085e3d06576286b7355b1 Cr-Commit-Position: refs/heads/master@{#374110}
4 years, 10 months ago (2016-02-08 12:07:26 UTC) #44
Nico
https://codereview.chromium.org/1568523002/diff/580001/content/common/websocket_messages.h File content/common/websocket_messages.h (right): https://codereview.chromium.org/1568523002/diff/580001/content/common/websocket_messages.h#newcode134 content/common/websocket_messages.h:134: IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete); please remove this trailing semicolon: ..\..\content/common/websocket_messages.h(134,51) : error: ...
4 years, 10 months ago (2016-02-08 19:03:55 UTC) #46
Adam Rice
4 years, 10 months ago (2016-02-09 06:18:58 UTC) #47
Message was sent while issue was closed.
https://codereview.chromium.org/1568523002/diff/580001/content/common/websock...
File content/common/websocket_messages.h (right):

https://codereview.chromium.org/1568523002/diff/580001/content/common/websock...
content/common/websocket_messages.h:134:
IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete);
On 2016/02/08 at 19:03:55, Nico wrote:
> please remove this trailing semicolon:

Sorry about that. This was fixed by mbarbella in
https://codereview.chromium.org/1680753002/

Powered by Google App Engine
This is Rietveld 408576698