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

Issue 2171843002: Use array<uint8> rather than string to pass BroadcastChannel messages. (Closed)

Created:
4 years, 5 months ago by Marijn Kruisselbrink
Modified:
4 years, 5 months ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, blink-reviews, blink-reviews-api_chromium.org, chromium-reviews, darin (slow to review), darin-cc_chromium.org, dglazkov+blink, haraken, jam, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use array<uint8> rather than string to pass BroadcastChannel messages. Even though SerializedScriptValue normally serializes values to a WTF::String, the string isn't actually a valid unicode string. Because of that it can't be safely passed over mojo as a string (invalid strings get silently converted to null). This changes the mojo interface to use array<uint8> instead, thereby making sure arbitrary values get passed across correctly. BUG=630203 Committed: https://crrev.com/af71dd08b3a335dd78e541e03c379e99a83f57a7 Cr-Commit-Position: refs/heads/master@{#407048}

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -14 lines) Patch
M content/browser/broadcast_channel/broadcast_channel_provider.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/broadcast_channel/broadcast_channel_provider.cc View 3 chunks +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp View 2 chunks +7 lines, -4 lines 4 comments Download
M third_party/WebKit/public/platform/modules/broadcastchannel/broadcast_channel.mojom View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 21 (8 generated)
Marijn Kruisselbrink
rocket: to sanity check that array<uint8> is indeed the canonical way in mojo to pass ...
4 years, 5 months ago (2016-07-21 17:15:01 UTC) #4
Ken Rockot(use gerrit already)
lgtm optionally since you're changing this mojom and the API surface is still very small, ...
4 years, 5 months ago (2016-07-21 17:21:35 UTC) #5
Ken Rockot(use gerrit already)
On 2016/07/21 at 17:21:35, Ken Rockot wrote: > lgtm > > optionally since you're changing ...
4 years, 5 months ago (2016-07-21 17:23:43 UTC) #6
Marijn Kruisselbrink
On 2016/07/21 at 17:23:43, rockot wrote: > On 2016/07/21 at 17:21:35, Ken Rockot wrote: > ...
4 years, 5 months ago (2016-07-21 17:28:34 UTC) #7
Ken Rockot(use gerrit already)
On 2016/07/21 at 17:28:34, mek wrote: > On 2016/07/21 at 17:23:43, rockot wrote: > > ...
4 years, 5 months ago (2016-07-21 17:30:16 UTC) #8
dcheng
mojom lgtm https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp File third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp (right): https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp#newcode69 third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp:69: mojoData.appendVector(data); It's sad that this results in ...
4 years, 5 months ago (2016-07-22 02:33:03 UTC) #11
Marijn Kruisselbrink
https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp File third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp (right): https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp#newcode69 third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp:69: mojoData.appendVector(data); On 2016/07/22 at 02:33:03, dcheng wrote: > It's ...
4 years, 5 months ago (2016-07-22 03:23:13 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2171843002/1
4 years, 5 months ago (2016-07-22 03:24:05 UTC) #14
dcheng
On 2016/07/22 03:23:13, Marijn Kruisselbrink wrote: > https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp > File third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp > (right): > > ...
4 years, 5 months ago (2016-07-22 03:26:22 UTC) #15
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 5 months ago (2016-07-22 03:52:37 UTC) #16
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/af71dd08b3a335dd78e541e03c379e99a83f57a7 Cr-Commit-Position: refs/heads/master@{#407048}
4 years, 5 months ago (2016-07-22 03:54:50 UTC) #18
esprehn
https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp File third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp (right): https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp#newcode66 third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp:66: Vector<char> data; you want to call reserveInitialCapacity on both ...
4 years, 5 months ago (2016-07-23 08:53:50 UTC) #20
Marijn Kruisselbrink
4 years, 5 months ago (2016-07-23 19:14:18 UTC) #21
Message was sent while issue was closed.
https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/m...
File third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp
(right):

https://codereview.chromium.org/2171843002/diff/1/third_party/WebKit/Source/m...
third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp:66:
Vector<char> data;
On 2016/07/23 at 08:53:50, esprehn wrote:
> you want to call reserveInitialCapacity on both of these vectors to avoid
resizes and copies. :)

Not sure what resized and copies that would avoid?
SerializedScriptValue::toWireBytes resizes the output vector appropriately
before adding anything to it, and similarly Vector::appendVector resizes before
appending all the data. So both these vectors will only get resized once anyway.
Maybe it would make sense to add a
SerializedScriptValue::toWireBytes(Vector<uint8_t>&) overload to avoid having to
go through the extra Vector<char>, as that's a copy that really shouldn't be
necessary.

Powered by Google App Engine
This is Rietveld 408576698