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

Issue 23684017: [GCM] Initial work to set up directory structure and introduce socket integration (Closed)

Created:
7 years, 3 months ago by Nicolas Zea
Modified:
7 years, 2 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, Ryan Sleevi, tim (not reviewing), Dmitry Titov
Visibility:
Public.

Description

[GCM] Initial work to set up directory structure and introduce socket integration Create new google_api/gcm directory, and add some of the initial base logic for integrating protobufs with chrome sockets. A SocketStream is an implementation of the ZeroCopyStream interfaces that allows for asynchronously retrieving a message (with timeout support) which can then be parsed by a CodedInputStream, or alternatively allows a CodedOutputStream to write into a Chrome socket. Once a SocketStream closes itself (which will happen on error or timeout), the stream cannot be reused, and a new one should be created (typically with a socket that has been reconnected). In general, the state of the socket stream must be checked before interacting with it. Also fixes issue in SocketTestUtil where mock Sockets aren't taking ownership of IOBuffers that they're using (exposed by tests). TBR=darin@chromium.org BUG=284553 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=229533

Patch Set 1 #

Patch Set 2 : Self review #

Total comments: 15

Patch Set 3 : Make SocketStream asynchronous. Remove custom data provider #

Total comments: 10

Patch Set 4 : Address comments #

Total comments: 6

Patch Set 5 : Review + refactor timeout logic into separate component #

Total comments: 4

Patch Set 6 : address comments #

Total comments: 43

Patch Set 7 : Address comments #

Total comments: 20

Patch Set 8 : Address comments #

Patch Set 9 : Use SetOffset instead of recreating DrainableIOBuffer #

Total comments: 20

Patch Set 10 : Address comments #

Patch Set 11 : Address comments #

Total comments: 12

Patch Set 12 : Address comments #

Patch Set 13 : Switch to GetState() #

Total comments: 44

Patch Set 14 : Address comments #

Total comments: 26

Patch Set 15 : Comments #

Patch Set 16 : StringPiece + UnreadByteCount #

Total comments: 34

Patch Set 17 : Comments #

Total comments: 2

Patch Set 18 : Final nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1044 lines, -10 lines) Patch
M build/all.gyp View 1 chunk +5 lines, -0 lines 0 comments Download
A + google_apis/gcm/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +3 lines, -5 lines 0 comments Download
A google_apis/gcm/OWNERS View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +3 lines, -0 lines 0 comments Download
A google_apis/gcm/base/gcm_export.h View 1 2 1 chunk +29 lines, -0 lines 0 comments Download
A google_apis/gcm/base/socket_stream.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +205 lines, -0 lines 0 comments Download
A google_apis/gcm/base/socket_stream.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +332 lines, -0 lines 0 comments Download
A google_apis/gcm/base/socket_stream_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +406 lines, -0 lines 0 comments Download
A google_apis/gcm/gcm.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +56 lines, -0 lines 0 comments Download
M net/socket/socket_test_util.h View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M net/socket/socket_test_util.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 46 (0 generated)
Nicolas Zea
Ryan, this is the socket integration I mentioned during the eng review. Mind taking a ...
7 years, 3 months ago (2013-09-03 20:14:57 UTC) #1
Ryan Sleevi
Initial comments, based in part on what we chatted about. https://codereview.chromium.org/23684017/diff/3001/google_apis/gcm/base/gcm_export.h File google_apis/gcm/base/gcm_export.h (right): https://codereview.chromium.org/23684017/diff/3001/google_apis/gcm/base/gcm_export.h#newcode16 ...
7 years, 3 months ago (2013-09-03 23:04:07 UTC) #2
Nicolas Zea
https://codereview.chromium.org/23684017/diff/3001/google_apis/gcm/base/socket_stream.h File google_apis/gcm/base/socket_stream.h (right): https://codereview.chromium.org/23684017/diff/3001/google_apis/gcm/base/socket_stream.h#newcode35 google_apis/gcm/base/socket_stream.h:35: : public google::protobuf::io::ZeroCopyInputStream { On 2013/09/03 23:04:08, Ryan Sleevi ...
7 years, 3 months ago (2013-09-04 00:43:33 UTC) #3
Nicolas Zea
PTAL. In particular, I've made SocketStream completely asynchronous (there's a GetNextMessage method that will read ...
7 years, 3 months ago (2013-09-07 01:07:52 UTC) #4
Ryan Sleevi
Ok, I'm still a little concerned about the interaction between the pseudo-blockiness and how net::SocketStream ...
7 years, 3 months ago (2013-09-10 19:35:27 UTC) #5
Nicolas Zea
On 2013/09/10 19:35:27, Ryan Sleevi wrote: > Ok, I'm still a little concerned about the ...
7 years, 3 months ago (2013-09-10 21:22:22 UTC) #6
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/14001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/14001/google_apis/gcm/base/socket_stream.cc#newcode286 google_apis/gcm/base/socket_stream.cc:286: base::MessageLoop::current()->PostTask(FROM_HERE, callback); On 2013/09/10 19:35:27, Ryan Sleevi wrote: ...
7 years, 3 months ago (2013-09-12 22:46:58 UTC) #7
Nicolas Zea
ping?
7 years, 3 months ago (2013-09-17 17:45:11 UTC) #8
Ryan Sleevi
Sorry, I'm still having trouble mapping in all the assumptions about Protobuf as well as ...
7 years, 3 months ago (2013-09-17 19:43:30 UTC) #9
Ryan Sleevi
Moving myself to CC and Fred to owner, as he's graciously agreed to take over ...
7 years, 3 months ago (2013-09-20 22:14:11 UTC) #10
Nicolas Zea
Fred, PTAL. I've gone ahead and pulled all timeout logic out of the SocketInputStream implementation, ...
7 years, 2 months ago (2013-09-25 01:21:27 UTC) #11
akalin
Actually, Ryan will take a look for now, since I'm going on sick leave starting ...
7 years, 2 months ago (2013-09-25 21:49:27 UTC) #12
Ryan Sleevi
A few draft comments I had saved before I saw your larger CL https://codereview.chromium.org/23684017/diff/28001/google_apis/gcm/DEPS File ...
7 years, 2 months ago (2013-09-25 23:30:24 UTC) #13
Nicolas Zea
Forgot to publish the changes. I've addressed the comments, as well as made some slight ...
7 years, 2 months ago (2013-10-02 22:56:02 UTC) #14
akalin
first pass, mainly concentrated on SocketInputStream https://codereview.chromium.org/23684017/diff/35001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/35001/google_apis/gcm/base/socket_stream.cc#newcode14 google_apis/gcm/base/socket_stream.cc:14: // TODO(zea): consider ...
7 years, 2 months ago (2013-10-04 18:37:04 UTC) #15
Nicolas Zea
Comments addressed, PTAL https://codereview.chromium.org/23684017/diff/35001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/35001/google_apis/gcm/base/socket_stream.cc#newcode14 google_apis/gcm/base/socket_stream.cc:14: // TODO(zea): consider having dynamically sized ...
7 years, 2 months ago (2013-10-04 20:55:28 UTC) #16
akalin
few more https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode24 google_apis/gcm/base/socket_stream.cc:24: io_buffer_(new net::IOBufferWithSize(kDefaultBufferSize)), plain IOBuffer here? https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode87 google_apis/gcm/base/socket_stream.cc:87: ...
7 years, 2 months ago (2013-10-07 23:00:07 UTC) #17
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode24 google_apis/gcm/base/socket_stream.cc:24: io_buffer_(new net::IOBufferWithSize(kDefaultBufferSize)), On 2013/10/07 23:00:08, akalin wrote: > ...
7 years, 2 months ago (2013-10-09 00:44:22 UTC) #18
akalin
https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode193 google_apis/gcm/base/socket_stream.cc:193: drainable_io_buffer_ = new net::DrainableIOBuffer(io_buffer_.get(), On 2013/10/09 00:44:22, Nicolas Zea ...
7 years, 2 months ago (2013-10-09 22:04:27 UTC) #19
Nicolas Zea
Doh. PTAL https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode193 google_apis/gcm/base/socket_stream.cc:193: drainable_io_buffer_ = new net::DrainableIOBuffer(io_buffer_.get(), On 2013/10/09 22:04:28, ...
7 years, 2 months ago (2013-10-09 23:24:49 UTC) #20
akalin
few more, almost there I think https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode132 google_apis/gcm/base/socket_stream.cc:132: drainable_io_buffer_->SetOffset(unread_buffer_size); On 2013/10/09 ...
7 years, 2 months ago (2013-10-10 08:47:40 UTC) #21
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/46001/google_apis/gcm/base/socket_stream.cc#newcode132 google_apis/gcm/base/socket_stream.cc:132: drainable_io_buffer_->SetOffset(unread_buffer_size); On 2013/10/10 08:47:40, akalin wrote: > On ...
7 years, 2 months ago (2013-10-11 01:14:30 UTC) #22
akalin
couple more https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc#newcode8 google_apis/gcm/base/socket_stream.cc:8: #include "base/message_loop/message_loop.h" if you remove all task ...
7 years, 2 months ago (2013-10-11 16:47:21 UTC) #23
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc#newcode8 google_apis/gcm/base/socket_stream.cc:8: #include "base/message_loop/message_loop.h" On 2013/10/11 16:47:22, akalin wrote: > ...
7 years, 2 months ago (2013-10-11 18:28:32 UTC) #24
akalin
https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc#newcode149 google_apis/gcm/base/socket_stream.cc:149: DCHECK_EQ(state_, READING); is this DCHECK still valid? you immediately ...
7 years, 2 months ago (2013-10-11 18:47:08 UTC) #25
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/65013/google_apis/gcm/base/socket_stream.cc#newcode149 google_apis/gcm/base/socket_stream.cc:149: DCHECK_EQ(state_, READING); On 2013/10/11 18:47:09, akalin wrote: > ...
7 years, 2 months ago (2013-10-11 23:41:28 UTC) #26
akalin
Remaining nits for socket_stream.{h,cc}, looking at test file and rest of CL now. https://codereview.chromium.org/23684017/diff/99001/google_apis/gcm/base/socket_stream.cc File ...
7 years, 2 months ago (2013-10-12 03:18:36 UTC) #27
Nicolas Zea
Comments addressed, PTAL https://codereview.chromium.org/23684017/diff/99001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/99001/google_apis/gcm/base/socket_stream.cc#newcode36 google_apis/gcm/base/socket_stream.cc:36: DCHECK_NE(GetState(), CLOSED); On 2013/10/12 03:18:36, akalin ...
7 years, 2 months ago (2013-10-14 23:39:15 UTC) #28
akalin
few more test comments https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream.cc#newcode162 google_apis/gcm/base/socket_stream.cc:162: result = net::ERR_UNEXPECTED; ERR_UNEXPECTED is ...
7 years, 2 months ago (2013-10-15 00:56:06 UTC) #29
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream.cc File google_apis/gcm/base/socket_stream.cc (right): https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream.cc#newcode162 google_apis/gcm/base/socket_stream.cc:162: result = net::ERR_UNEXPECTED; On 2013/10/15 00:56:07, akalin wrote: ...
7 years, 2 months ago (2013-10-15 20:07:37 UTC) #30
akalin
https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream_unittest.cc File google_apis/gcm/base/socket_stream_unittest.cc (right): https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream_unittest.cc#newcode103 google_apis/gcm/base/socket_stream_unittest.cc:103: uint64 GCMSocketStreamTest::DoInputStreamRead(uint64 bytes, On 2013/10/15 20:07:38, Nicolas Zea wrote: ...
7 years, 2 months ago (2013-10-15 23:24:14 UTC) #31
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream_unittest.cc File google_apis/gcm/base/socket_stream_unittest.cc (right): https://codereview.chromium.org/23684017/diff/114001/google_apis/gcm/base/socket_stream_unittest.cc#newcode103 google_apis/gcm/base/socket_stream_unittest.cc:103: uint64 GCMSocketStreamTest::DoInputStreamRead(uint64 bytes, On 2013/10/15 23:24:15, akalin wrote: ...
7 years, 2 months ago (2013-10-16 01:20:40 UTC) #32
akalin
mostly nits at this point https://codereview.chromium.org/23684017/diff/114001/net/socket/socket_test_util.h File net/socket/socket_test_util.h (right): https://codereview.chromium.org/23684017/diff/114001/net/socket/socket_test_util.h#newcode719 net/socket/socket_test_util.h:719: scoped_refptr<IOBuffer> pending_buf_; On 2013/10/15 ...
7 years, 2 months ago (2013-10-16 07:16:31 UTC) #33
Nicolas Zea
PTAL https://codereview.chromium.org/23684017/diff/140001/google_apis/gcm/DEPS File google_apis/gcm/DEPS (right): https://codereview.chromium.org/23684017/diff/140001/google_apis/gcm/DEPS#newcode2 google_apis/gcm/DEPS:2: "-chrome", On 2013/10/16 07:16:31, akalin wrote: > don't ...
7 years, 2 months ago (2013-10-16 19:56:17 UTC) #34
akalin
lgtm after nits hooray! https://codereview.chromium.org/23684017/diff/140001/google_apis/gcm/base/socket_stream_unittest.cc File google_apis/gcm/base/socket_stream_unittest.cc (right): https://codereview.chromium.org/23684017/diff/140001/google_apis/gcm/base/socket_stream_unittest.cc#newcode319 google_apis/gcm/base/socket_stream_unittest.cc:319: std::string full_data = std::string(kWriteData); On ...
7 years, 2 months ago (2013-10-16 23:44:24 UTC) #35
Nicolas Zea
Done, yay! Thanks for the patient review. TBR'ing Daring for adding base/ and google/ the ...
7 years, 2 months ago (2013-10-17 19:51:52 UTC) #36
Nicolas Zea
+Joi for addition to google_apis/ directory. The eng review suggested it as the destination because ...
7 years, 2 months ago (2013-10-17 19:58:18 UTC) #37
Jói
Addition to google_apis LGTM. This is exactly the place for stuff like this, and your ...
7 years, 2 months ago (2013-10-17 22:05:11 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/23684017/168001
7 years, 2 months ago (2013-10-17 23:17:18 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/23684017/168001
7 years, 2 months ago (2013-10-18 01:17:58 UTC) #40
commit-bot: I haz the power
Step "update" is always a major failure. Look at the try server FAQ for more ...
7 years, 2 months ago (2013-10-18 18:12:51 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/23684017/168001
7 years, 2 months ago (2013-10-18 20:24:41 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/23684017/168001
7 years, 2 months ago (2013-10-18 20:57:56 UTC) #43
commit-bot: I haz the power
Retried try job too often on win7_aura for step(s) app_list_unittests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win7_aura&number=90517
7 years, 2 months ago (2013-10-19 03:59:20 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/23684017/168001
7 years, 2 months ago (2013-10-19 04:59:58 UTC) #45
commit-bot: I haz the power
7 years, 2 months ago (2013-10-19 10:23:22 UTC) #46
Message was sent while issue was closed.
Change committed as 229533

Powered by Google App Engine
This is Rietveld 408576698