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

Issue 10796107: WebSocketFrameChunk should use IOBuffer to hold data (Closed)

Created:
8 years, 5 months ago by Takashi Toyoshima
Modified:
8 years, 4 months ago
CC:
bashi, chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org
Visibility:
Public.

Description

Now WebSocketFrameChunk use std::vector<char> to hold payload data. But, SpdyStream and StreamSocket use IOBuffer in their interfaces. To reduce memory copies, we should use IOBuffer to hold data. BUG=none TEST=net_unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=149387

Patch Set 1 #

Total comments: 8

Patch Set 2 : reflect yutak's review #

Total comments: 5

Patch Set 3 : revised #

Total comments: 8

Patch Set 4 : again #

Patch Set 5 : handle size 0 body #

Patch Set 6 : s/uint64_t/uint64/g #

Total comments: 5

Patch Set 7 : use begin() and end() instead of data() for android #

Patch Set 8 : again #

Patch Set 9 : fail on large frames #

Patch Set 10 : rebase #

Patch Set 11 : fix test expectation #

Total comments: 9

Patch Set 12 : style nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -47 lines) Patch
M net/websockets/websocket_frame.h View 1 2 3 4 2 chunks +6 lines, -2 lines 0 comments Download
M net/websockets/websocket_frame.cc View 1 chunk +1 line, -0 lines 0 comments Download
M net/websockets/websocket_frame_parser.h View 1 chunk +1 line, -1 line 0 comments Download
M net/websockets/websocket_frame_parser.cc View 1 2 3 4 5 6 7 8 5 chunks +25 lines, -13 lines 0 comments Download
M net/websockets/websocket_frame_parser_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 14 chunks +88 lines, -31 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
Takashi Toyoshima
Hi Yuta, What do you think about this change? Currently, I use WebSocketFrameChunk in my ...
8 years, 5 months ago (2012-07-24 12:40:42 UTC) #1
Yuta Kitamura
I think it's fine to use IOBuffer here. Want to hear from Will and Matt. ...
8 years, 4 months ago (2012-07-26 09:48:48 UTC) #2
Takashi Toyoshima
Yuta, Thank you for comments. I upload revised version. Matt, and Will, Could you sanctify ...
8 years, 4 months ago (2012-07-26 12:39:04 UTC) #3
mmenke
http://codereview.chromium.org/10796107/diff/8001/net/websockets/websocket_frame.h File net/websockets/websocket_frame.h (right): http://codereview.chromium.org/10796107/diff/8001/net/websockets/websocket_frame.h#newcode83 net/websockets/websocket_frame.h:83: uint64_t size; Do we really need a 64-bit unsigned ...
8 years, 4 months ago (2012-07-26 14:44:45 UTC) #4
Yuta Kitamura
http://codereview.chromium.org/10796107/diff/1/net/websockets/websocket_frame_parser_unittest.cc File net/websockets/websocket_frame_parser_unittest.cc (right): http://codereview.chromium.org/10796107/diff/1/net/websockets/websocket_frame_parser_unittest.cc#newcode70 net/websockets/websocket_frame_parser_unittest.cc:70: EXPECT_TRUE(!memcmp(kHello, frame->data->data(), kHelloLength)); On 2012/07/26 12:39:05, toyoshim wrote: > ...
8 years, 4 months ago (2012-07-27 08:01:07 UTC) #5
Takashi Toyoshima
Thanks. I fixed the change to use IOBufferWithSize. http://codereview.chromium.org/10796107/diff/1/net/websockets/websocket_frame_parser_unittest.cc File net/websockets/websocket_frame_parser_unittest.cc (right): http://codereview.chromium.org/10796107/diff/1/net/websockets/websocket_frame_parser_unittest.cc#newcode70 net/websockets/websocket_frame_parser_unittest.cc:70: EXPECT_TRUE(!memcmp(kHello, ...
8 years, 4 months ago (2012-07-27 10:28:42 UTC) #6
mmenke
http://codereview.chromium.org/10796107/diff/14001/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/14001/net/websockets/websocket_frame_parser.cc#newcode181 net/websockets/websocket_frame_parser.cc:181: current_frame_header_->payload_length - frame_offset_); Might want to DCHECK_LE(next_size, std::numeric_limits<int>::max()); http://codereview.chromium.org/10796107/diff/14001/net/websockets/websocket_frame_parser.cc#newcode188 ...
8 years, 4 months ago (2012-07-27 14:25:55 UTC) #7
Takashi Toyoshima
Hi Matt. Thank you for quick response. I revised my change again. http://codereview.chromium.org/10796107/diff/14001/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc ...
8 years, 4 months ago (2012-07-27 16:08:30 UTC) #8
mmenke
LGTM
8 years, 4 months ago (2012-07-27 16:11:00 UTC) #9
Takashi Toyoshima
Oops, DCHECK failed in IOBuffer because it doesn't accept size = 0. I need some ...
8 years, 4 months ago (2012-07-30 05:29:53 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/toyoshim@chromium.org/10796107/15002
8 years, 4 months ago (2012-07-30 06:31:18 UTC) #11
commit-bot: I haz the power
Try job failure for 10796107-15002 (retry) on android for steps "compile, build" (clobber build). It's ...
8 years, 4 months ago (2012-07-30 06:43:22 UTC) #12
Ryan Sleevi
drive by security concern http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc#newcode183 net/websockets/websocket_frame_parser.cc:183: DCHECK_LE(next_size, static_cast<uint64>(std::numeric_limits<int>::max())); nit: Is this ...
8 years, 4 months ago (2012-07-30 07:21:12 UTC) #13
Takashi Toyoshima
http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc#newcode183 net/websockets/websocket_frame_parser.cc:183: DCHECK_LE(next_size, static_cast<uint64>(std::numeric_limits<int>::max())); Agreed. RFC defines status code 1009 meaning ...
8 years, 4 months ago (2012-07-30 08:01:20 UTC) #14
Takashi Toyoshima
After Matt's LGTM, I update this change at following points. - IOBuffer doesn't allow 0 ...
8 years, 4 months ago (2012-07-30 08:28:57 UTC) #15
mmenke
http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/8004/net/websockets/websocket_frame_parser.cc#newcode183 net/websockets/websocket_frame_parser.cc:183: DCHECK_LE(next_size, static_cast<uint64>(std::numeric_limits<int>::max())); On 2012/07/30 08:01:21, toyoshim wrote: > Agreed. ...
8 years, 4 months ago (2012-07-30 13:26:57 UTC) #16
Takashi Toyoshima
In my last change (Patch Set 11), DCHECK failure case is blocked in DecodeFrameHeader() line ...
8 years, 4 months ago (2012-07-30 13:44:27 UTC) #17
mmenke
http://codereview.chromium.org/10796107/diff/5008/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/5008/net/websockets/websocket_frame_parser.cc#newcode125 net/websockets/websocket_frame_parser.cc:125: bool message_too_big = false; Why is this needed? We ...
8 years, 4 months ago (2012-07-30 14:20:08 UTC) #18
Takashi Toyoshima
Thank you for comments. And I'm sorry if I misunderstood your comments. The next reply ...
8 years, 4 months ago (2012-07-30 14:42:42 UTC) #19
mmenke
https://chromiumcodereview.appspot.com/10796107/diff/5008/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): https://chromiumcodereview.appspot.com/10796107/diff/5008/net/websockets/websocket_frame_parser.cc#newcode144 net/websockets/websocket_frame_parser.cc:144: if (payload_length > static_cast<uint64>(kint32max)) On 2012/07/30 14:42:42, toyoshim wrote: ...
8 years, 4 months ago (2012-07-30 14:55:53 UTC) #20
mmenke
On 2012/07/30 14:55:53, Matt Menke wrote: > https://chromiumcodereview.appspot.com/10796107/diff/5008/net/websockets/websocket_frame_parser.cc > File net/websockets/websocket_frame_parser.cc (right): > > https://chromiumcodereview.appspot.com/10796107/diff/5008/net/websockets/websocket_frame_parser.cc#newcode144 ...
8 years, 4 months ago (2012-07-30 14:56:54 UTC) #21
Takashi Toyoshima
Yes. WebSocket is not a stream based protocol, but a message oriented one. Also JavaScript ...
8 years, 4 months ago (2012-07-30 15:57:59 UTC) #22
mmenke
On 2012/07/30 15:57:59, toyoshim wrote: > Yes. WebSocket is not a stream based protocol, but ...
8 years, 4 months ago (2012-07-30 16:00:40 UTC) #23
Takashi Toyoshima
Memo: At least, I'll reuse these components in following implementation. - flip server to support ...
8 years, 4 months ago (2012-07-30 16:10:56 UTC) #24
mmenke
Code still LGTM. http://codereview.chromium.org/10796107/diff/5008/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc (right): http://codereview.chromium.org/10796107/diff/5008/net/websockets/websocket_frame_parser.cc#newcode48 net/websockets/websocket_frame_parser.cc:48: bool WebSocketFrameParser::Decode( Just a random note ...
8 years, 4 months ago (2012-07-31 17:03:49 UTC) #25
Takashi Toyoshima
Thank you, Matt. I'll land this CL with fixing nits you found. http://codereview.chromium.org/10796107/diff/5008/net/websockets/websocket_frame_parser.cc File net/websockets/websocket_frame_parser.cc ...
8 years, 4 months ago (2012-08-01 07:06:33 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/toyoshim@chromium.org/10796107/13016
8 years, 4 months ago (2012-08-01 07:06:55 UTC) #27
commit-bot: I haz the power
8 years, 4 months ago (2012-08-01 08:31:34 UTC) #28
Change committed as 149387

Powered by Google App Engine
This is Rietveld 408576698