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

Issue 13251: Add a ProxyScriptFetcher class for doing asynch downloads of PAC scripts.... (Closed)

Created:
12 years ago by eroman
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Add a ProxyScriptFetcher class for doing asynch downloads of PAC scripts.This object will be owned by ProxyService. It will be used to manage the fetching of PAC scripts (on the IO thread, using the primary URLRequestContext).BUG=74, 2764 (partial) Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=6699

Patch Set 1 #

Total comments: 67

Patch Set 2 : '' #

Total comments: 20

Patch Set 3 : '' #

Total comments: 4

Patch Set 4 : '' #

Patch Set 5 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+702 lines, -0 lines) Patch
M net/base/load_flags.h View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M net/base/net_error_list.h View 1 2 3 4 1 chunk +3 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/404.pac View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/404.pac.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/500.pac View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/500.pac.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/downloadable.pac View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/downloadable.pac.mock-http-headers View 1 chunk +3 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/large-pac.nsproxy View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/large-pac.nsproxy.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.html View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.nsproxy View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.txt View 1 chunk +1 line, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.html.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.nsproxy.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
A net/data/proxy_script_fetcher_unittest/pac.txt.mock-http-headers View 1 chunk +2 lines, -0 lines 0 comments Download
M net/http/http_network_transaction.cc View 1 2 3 4 2 chunks +9 lines, -0 lines 0 comments Download
M net/net_lib.scons View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M net/net_unittests.scons View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
A net/proxy/proxy_script_fetcher.h View 1 2 3 1 chunk +67 lines, -0 lines 0 comments Download
A net/proxy/proxy_script_fetcher.cc View 1 2 3 4 1 chunk +301 lines, -0 lines 0 comments Download
A net/proxy/proxy_script_fetcher_unittest.cc View 1 2 3 4 1 chunk +294 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
eroman
(depends on codereview 12938)
12 years ago (2008-12-08 18:58:08 UTC) #1
wtc
I have reviewed everything but the unit test. I'll finish the review tomorrow. Here are ...
12 years ago (2008-12-09 02:38:18 UTC) #2
darin (slow to review)
Great stuff! http://codereview.chromium.org/13251/diff/1/8 File net/base/load_flags.h (right): http://codereview.chromium.org/13251/diff/1/8#newcode70 Line 70: LOAD_BYPASS_PROXY_SERVICE = 1 << 15, LOAD_BYPASS_PROXY ...
12 years ago (2008-12-09 16:19:47 UTC) #3
wtc
http://codereview.chromium.org/13251/diff/1/11 File net/proxy/proxy_script_fetcher.h (right): http://codereview.chromium.org/13251/diff/1/11#newcode44 Line 44: virtual void Fetch(const GURL& url, std::string* bytes, On ...
12 years ago (2008-12-09 21:06:56 UTC) #4
eroman
http://codereview.chromium.org/13251/diff/1/8 File net/base/load_flags.h (right): http://codereview.chromium.org/13251/diff/1/8#newcode68 Line 68: // Do not resolve URLs using the configured ...
12 years ago (2008-12-09 21:47:02 UTC) #5
wtc
http://codereview.chromium.org/13251/diff/206/214 File net/proxy/proxy_script_fetcher_unittest.cc (right): http://codereview.chromium.org/13251/diff/206/214#newcode11 Line 11: #include "base/path_service.h" Nit: list "base/path_service.h" before the "net/*.h" ...
12 years ago (2008-12-09 22:02:52 UTC) #6
eroman
http://codereview.chromium.org/13251/diff/1/7 File net/base/net_error_list.h (right): http://codereview.chromium.org/13251/diff/1/7#newcode94 Line 94: NET_ERROR(PAC_BAD_MIME_TYPE, -115) On 2008/12/09 16:19:47, darin wrote: > ...
12 years ago (2008-12-09 22:32:48 UTC) #7
wtc
http://codereview.chromium.org/13251/diff/1/7 File net/base/net_error_list.h (right): http://codereview.chromium.org/13251/diff/1/7#newcode97 Line 97: NET_ERROR(PAC_BAD_STATUS_CODE, -116) On 2008/12/09 21:47:02, eroman wrote: > ...
12 years ago (2008-12-10 01:46:40 UTC) #8
wtc
LGTM. I feel rather strongly about changing base::TimeDelta back to int or size_t. See below. ...
12 years ago (2008-12-10 01:58:09 UTC) #9
eroman
12 years ago (2008-12-10 09:18:05 UTC) #10
Any further comments I will address in a subsequent CL. Committed.

http://codereview.chromium.org/13251/diff/1/10
File net/proxy/proxy_script_fetcher.cc (right):

http://codereview.chromium.org/13251/diff/1/10#newcode128
Line 128: next_id_(1),
On 2008/12/10 01:46:40, wtc wrote:
> On 2008/12/09 21:47:02, eroman wrote:
> >
> > If I go with pre-increment, I would also want to change the name (since it
is
> no
> > longer the "next id", but before-next-id). Perhaps "id_ = ++request_count_;"
> in
> > such case?
> > 
> > For now I have left it as is; let me know how to proceed.
> 
> It's fine to leave it as is.
> 
> I think it's fine to pre-increment a variable named
> next_id_.  To me, it's just like naming a parameter
> int* result instead of int* result_ptr.  It's a little
> ambiguous but an experienced programmer usually prefers
> it over a more accurate but also more verbose name.
> 
> 

Done -- pre-increment on next_id_.

http://codereview.chromium.org/13251/diff/1/11
File net/proxy/proxy_script_fetcher.h (right):

http://codereview.chromium.org/13251/diff/1/11#newcode23
Line 23: virtual ~ProxyScriptFetcher() { }
On 2008/12/10 01:46:40, wtc wrote:
> On 2008/12/09 21:47:02, eroman wrote:
> >
> > What is the problem on this line? (I ran cpplint but it didn't turn anything
> up
> > on this)
> 
> Sorry, I thought cpplint.py complains about this.
> This is the "No spaces inside empty braces" rule in
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Horizontal_Whi...
> 
> 

Done.

http://codereview.chromium.org/13251/diff/206/214
File net/proxy/proxy_script_fetcher_unittest.cc (right):

http://codereview.chromium.org/13251/diff/206/214#newcode11
Line 11: #include "base/path_service.h"
On 2008/12/09 22:02:52, wtc wrote:
> Nit: list "base/path_service.h" before the "net/*.h" headers.

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode56
Line 56: // signalled, and the values read will have been written to |result_|.
On 2008/12/09 22:02:52, wtc wrote:
> Nit: "values" => "bytes"?
> 
> "|result_|" => "|fetch_result_|"

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode96
Line 96: // Teardown the state in |io_thread_|.
On 2008/12/09 22:02:52, wtc wrote:
> Nit: "Teardown" => "Tear down".

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode112
Line 112: // ProxyScriptFetcher.
On 2008/12/09 22:02:52, wtc wrote:
> Nit ^2: you may want to indicate that the URLRequestContext
> and the ProxyScriptFetcher are part of thread_helper_.  It
> took me a few seconds to figure that out.

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode150
Line 150: // Get a file:// url relative to
net/data/proxy/proxy_script_fetcher_unittest
On 2008/12/09 22:02:52, wtc wrote:
> Nit: add period at end of sentence.

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode160
Line 160: 
On 2008/12/09 22:02:52, wtc wrote:
> It would be nice to explain what you intend to accomplish by
> repeating every test twice.  It's not obvious to me at all.

I removed the repeat twice; it was prompted by paranoia.

http://codereview.chromium.org/13251/diff/206/214#newcode164
Line 164: // Fetch a non-existant file (repeat twice).
On 2008/12/09 22:02:52, wtc wrote:
> Nit: "non-existant" => "non-existent".

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode250
Line 250: // would ordinarily make it download -- should have no effect.
On 2008/12/09 22:02:52, wtc wrote:
> "make it download" => "make it a download"?

Reworded differently.

http://codereview.chromium.org/13251/diff/206/214#newcode268
Line 268: server.TestServerPage("files/large-pac.nsproxy"),
On 2008/12/09 22:02:52, wtc wrote:
> Nit: indent by 2?

Done.

http://codereview.chromium.org/13251/diff/206/214#newcode303
Line 303: // Try fetching a URL which takes 1.2 seconds. We should abort the
request
On 2008/12/09 22:02:52, wtc wrote:
> Important: please make sure this test is not flaky, that
> it'll still pass on slow or heavily loaded machines.

Shouldn't be flaky. I have tested in purify which is much slower, seems ok. To
be safe I have put a bigger gap in the numbers. (500ms timeout, 1.2 second
latency)

http://codereview.chromium.org/13251/diff/401/610
File net/proxy/proxy_script_fetcher.h (right):

http://codereview.chromium.org/13251/diff/401/610#newcode60
Line 60: const base::TimeDelta& timeout);
On 2008/12/10 01:58:10, wtc wrote:
> Now that I know that this 'timeout' eventually becomes the
> "int delay_ms" argument to MessageLoop::PostDelayedTask,
> I withdraw my suggestion of using the base::TimeDelta type.
> 
> I now think it should have the 'int' type (or size_t, if
> you insist in spite of the static_cast<int>), and the unit
> should be ms or sec. 

Done.

Changed both constraints to be "int". (The reason I had the bytes limit as an
int was to avoid needing to cast away a unsigned to signed comparison).

http://codereview.chromium.org/13251/diff/401/610#newcode62
Line 62: // Sets the maximum-response size for a fetch to |size_bytes|. Returns
the
On 2008/12/10 01:58:10, wtc wrote:
> Nit: remove the "-" in "maximum-response".

Done.

Powered by Google App Engine
This is Rietveld 408576698