Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(675)

Issue 5864055: rlz: Add an implementation of PingServer() that uses chrome's net stack. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by thakis
Modified:
12 years, 1 month ago
CC:
rlz-codereviews_googlegroups.com, akalin
Base URL:
https://rlz.googlecode.com/svn/trunk
Visibility:
Public.

Description

rlz: Add an implementation of PingServer() that uses chrome's net stack. One can select an implementation via a gyp variable that defaults to wininet on windows. PingServer() currently has blocking semantics (it's already called on a thread in chrome), so the chrome net implementation is that way too. However, when chrome's net stack is used, an URLRequestContextGetter needs to be passed to rlz explicitly. That's a bit fishy from an API perspective, but having a 2nd DNS resolver, proxy cache, etc in chrome just for RLZ felt wrong. Unfortunately, URLFetcher is currently in chrome's 'content' module, so this adds a dependency on 'content'. akalin is moving it to 'net', and once that's done only a dependency on 'net' is required. In the test code, I was careful to not use BrowserThread, so that the test doesn't depend on 'content' either. BUG=chromium:117741 TEST=run rlz_unittests on mac with a local server, observe request

Patch Set 1 #

Total comments: 1

Patch Set 2 : . #

Patch Set 3 : Forgot test #

Patch Set 4 : . #

Total comments: 12

Patch Set 5 : rebase #

Patch Set 6 : comments #

Total comments: 1

Patch Set 7 : comment #

Patch Set 8 : rebase #

Patch Set 9 : . #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+231 lines, -31 lines) Patch
M lib/financial_ping.h View 2 chunks +10 lines, -0 lines 2 comments Download
M lib/financial_ping.cc View 1 2 3 4 5 5 chunks +110 lines, -27 lines 2 comments Download
M lib/lib_values.h View 1 chunk +0 lines, -1 line 0 comments Download
M lib/lib_values.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M lib/rlz_lib.h View 1 2 3 4 5 6 7 8 4 chunks +37 lines, -0 lines 0 comments Download
M lib/rlz_lib2.cc View 1 chunk +6 lines, -0 lines 0 comments Download
M lib/rlz_lib_test.cc View 1 2 3 4 5 6 3 chunks +37 lines, -1 line 0 comments Download
M rlz.gyp View 1 2 3 4 3 chunks +31 lines, -0 lines 1 comment Download

Messages

Total messages: 9
thakis
I think this design is the best tradeoff between rlz API stability and reusing chrome ...
12 years, 1 month ago (2012-03-21 21:12:57 UTC) #1
thakis
Forgot to say: I want to make chrome/windows use the chrome/net implementation too, the old ...
12 years, 1 month ago (2012-03-21 21:14:14 UTC) #2
Roger Tawa (Google)
Ni Nico, Some comments below. https://codereview.appspot.com/5864055/diff/5001/lib/financial_ping.cc File lib/financial_ping.cc (right): https://codereview.appspot.com/5864055/diff/5001/lib/financial_ping.cc#newcode273 lib/financial_ping.cc:273: request); nit: indents not ...
12 years, 1 month ago (2012-03-22 00:31:03 UTC) #3
thakis
Thanks for the comments! I'll upload a patchset that addressed the bits I didn't reply ...
12 years, 1 month ago (2012-03-22 00:37:57 UTC) #4
thakis
Thanks for the comments! I'll upload a patchset that addressed the bits I didn't reply ...
12 years, 1 month ago (2012-03-22 00:38:13 UTC) #5
thakis
https://codereview.appspot.com/5864055/diff/5001/lib/financial_ping.cc File lib/financial_ping.cc (right): https://codereview.appspot.com/5864055/diff/5001/lib/financial_ping.cc#newcode273 lib/financial_ping.cc:273: request); On 2012/03/22 00:31:03, rogerta wrote: > nit: indents ...
12 years, 1 month ago (2012-03-22 05:12:13 UTC) #6
Roger Tawa (Google)
lgtm, one nit below https://codereview.appspot.com/5864055/diff/1013/lib/rlz_lib_test.cc File lib/rlz_lib_test.cc (right): https://codereview.appspot.com/5864055/diff/1013/lib/rlz_lib_test.cc#newcode442 lib/rlz_lib_test.cc:442: rlz_lib::SetURLRequestContext(NULL); indent
12 years, 1 month ago (2012-03-22 12:56:00 UTC) #7
willchan
Mostly nits. The main thing I'm concerned about is your threading model now. https://codereview.appspot.com/5864055/diff/10001/lib/financial_ping.cc File ...
12 years, 1 month ago (2012-03-22 19:32:14 UTC) #8
thakis
12 years, 1 month ago (2012-03-23 01:14:23 UTC) #9
Thanks, Will!

I'm addressing the nits in https://codereview.appspot.com/5882054

https://codereview.appspot.com/5864055/diff/10001/lib/financial_ping.h
File lib/financial_ping.h (right):

https://codereview.appspot.com/5864055/diff/10001/lib/financial_ping.h#newcode53
lib/financial_ping.h:53: static bool
SetURLRequestContext(net::URLRequestContextGetter* context);
On 2012/03/22 19:32:14, willchan wrote:
> Is the threading model documented anywhere?

I don't think it's explicitly documented. Basically, every function that can be
accessed from several threads and isn't pure takes the rlz store lock.

As discussed over IRC, rlz used to schedule a new thread of every ping. I moved
it over to the file thread (here http://codereview.chromium.org/9404021 if
you're curious), which means the chrome net implementation now blocks the file
thread, which isn't so hot.

I'll check if brett's thread pool is now read to use and move the calling code
either to that or to creating a new thread using base/thread.h
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b