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

Issue 449973002: Use data reduction proxy when managed proxy config returns direct (Closed)

Created:
6 years, 4 months ago by bengr
Modified:
6 years, 4 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@no-uma-in-proxy-service
Project:
chromium
Visibility:
Public.

Description

Use data reduction proxy when managed proxy config returns direct Adds the configured data reduction proxies if any to the proxy info for a request, if the data reduction proxy is enabled, the data reduction proxies are not bypassed, and the proxy server returned by the proxy info if the request is direct. This change makes it possible for the data reduction proxy to coexist with managed proxy configurations, instead of being overwritten by them. The data reduction proxy may be disabled via managed prefs if this behavior is not desired. BUG=339237, 339258 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=289528

Patch Set 1 : #

Total comments: 12

Patch Set 2 : Addressed comments from marq and mef #

Patch Set 3 : Remove copy from ProxyConfig access #

Total comments: 7

Patch Set 4 : Fixed tests #

Total comments: 2

Patch Set 5 : Addressed comments from mmenke and mef #

Patch Set 6 : Fixed nits #

Patch Set 7 : Addressed comment and nit #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+301 lines, -72 lines) Patch
M android_webview/browser/aw_browser_context.h View 1 2 3 4 2 chunks +3 lines, -0 lines 0 comments Download
M android_webview/browser/aw_browser_context.cc View 1 2 3 4 1 chunk +8 lines, -7 lines 0 comments Download
M chrome/browser/net/chrome_network_delegate.h View 1 2 6 chunks +18 lines, -1 line 1 comment Download
M chrome/browser/net/chrome_network_delegate.cc View 1 2 2 chunks +10 lines, -2 lines 1 comment Download
M chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h View 1 2 3 4 2 chunks +24 lines, -1 line 3 comments Download
M chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc View 1 2 3 4 5 chunks +41 lines, -2 lines 5 comments Download
M chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator_unittest.cc View 1 2 3 4 5 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h View 1 2 3 4 1 chunk +1 line, -2 lines 1 comment Download
M chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc View 1 2 3 4 1 chunk +2 lines, -3 lines 1 comment Download
M chrome/browser/profiles/profile_impl.cc View 1 2 3 4 5 6 5 chunks +16 lines, -4 lines 0 comments Download
M chrome/browser/profiles/profile_impl_io_data.h View 1 2 3 4 5 4 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/profiles/profile_impl_io_data.cc View 1 2 3 4 5 6 4 chunks +9 lines, -0 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h View 3 chunks +4 lines, -0 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_protocol.cc View 1 2 chunks +13 lines, -0 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc View 1 2 3 4 2 chunks +94 lines, -24 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_settings.h View 1 2 3 4 4 chunks +4 lines, -4 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_settings.cc View 1 2 3 4 3 chunks +6 lines, -5 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_settings_test_utils.cc View 1 2 3 4 3 chunks +4 lines, -4 lines 0 comments Download
M components/data_reduction_proxy/browser/data_reduction_proxy_settings_unittest.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M net/base/network_delegate.h View 1 3 chunks +5 lines, -1 line 1 comment Download
M net/base/network_delegate.cc View 1 2 chunks +11 lines, -5 lines 0 comments Download
M net/proxy/proxy_service.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M net/proxy/proxy_service_unittest.cc View 1 2 3 3 chunks +13 lines, -3 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
bengr
mef: chrome/browser/net/chrome_network_delegate.* net/* marq: chrome/browser/net/spdyproxy/* components/data_reduction_proxy/* mmenke: chrome/browser/profiles/*
6 years, 4 months ago (2014-08-08 22:37:46 UTC) #1
marq (ping after 24h)
lgtm, just nits. https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.h File chrome/browser/net/chrome_network_delegate.h (right): https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.h#newcode178 chrome/browser/net/chrome_network_delegate.h:178: Extra line. https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc (right): ...
6 years, 4 months ago (2014-08-11 16:11:33 UTC) #2
mef
https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.cc#newcode442 chrome/browser/net/chrome_network_delegate.cc:442: proxy_service->proxy_retry_info(), If proxy_service is never NULL, should it be ...
6 years, 4 months ago (2014-08-11 19:44:40 UTC) #3
bengr
https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.cc File chrome/browser/net/chrome_network_delegate.cc (right): https://codereview.chromium.org/449973002/diff/60001/chrome/browser/net/chrome_network_delegate.cc#newcode442 chrome/browser/net/chrome_network_delegate.cc:442: proxy_service->proxy_retry_info(), On 2014/08/11 19:44:40, mef wrote: > If proxy_service ...
6 years, 4 months ago (2014-08-11 23:03:19 UTC) #4
bengr
6 years, 4 months ago (2014-08-12 17:21:24 UTC) #5
mef
Couple more notes. https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h (right): https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h#newcode58 chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:58: // effective configuration used by the ...
6 years, 4 months ago (2014-08-12 17:56:35 UTC) #6
mef
lgtm mod fixing the comment.
6 years, 4 months ago (2014-08-12 20:07:37 UTC) #7
bengr
https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h (right): https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h#newcode58 chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:58: // effective configuration used by the proxy service. Note ...
6 years, 4 months ago (2014-08-12 20:09:39 UTC) #8
mmenke
lgtm https://codereview.chromium.org/449973002/diff/120001/chrome/browser/profiles/profile_impl.cc File chrome/browser/profiles/profile_impl.cc (right): https://codereview.chromium.org/449973002/diff/120001/chrome/browser/profiles/profile_impl.cc#newcode666 chrome/browser/profiles/profile_impl.cc:666: data_reduction_proxy_params.Pass()); How is this safe? Looks like the ...
6 years, 4 months ago (2014-08-12 20:15:54 UTC) #9
mmenke
lgtm
6 years, 4 months ago (2014-08-12 20:15:55 UTC) #10
mmenke
lgtm
6 years, 4 months ago (2014-08-12 20:15:56 UTC) #11
mmenke
On 2014/08/12 20:15:56, mmenke wrote: > lgtm GRRR.... NOT LGTM. Dang buttons. Clicked to focus ...
6 years, 4 months ago (2014-08-12 20:16:29 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bengr@chromium.org/449973002/120001
6 years, 4 months ago (2014-08-12 20:18:53 UTC) #13
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-08-12 20:18:58 UTC) #14
commit-bot: I haz the power
A disapproval has been posted by following reviewers: mmenke@chromium.org. Please make sure to get positive ...
6 years, 4 months ago (2014-08-12 20:19:01 UTC) #15
mmenke
On 2014/08/12 20:16:29, mmenke wrote: > On 2014/08/12 20:15:56, mmenke wrote: > > lgtm > ...
6 years, 4 months ago (2014-08-12 20:19:18 UTC) #16
bengr
https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h (right): https://codereview.chromium.org/449973002/diff/100001/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h#newcode58 chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:58: // effective configuration used by the proxy service. Note ...
6 years, 4 months ago (2014-08-13 01:31:28 UTC) #17
bengr
sgurun: android_webview
6 years, 4 months ago (2014-08-13 01:32:08 UTC) #18
sgurun-gerrit only
On 2014/08/13 01:32:08, bengr1 wrote: > sgurun: android_webview aw lgtm
6 years, 4 months ago (2014-08-13 02:31:30 UTC) #19
mmenke
On 2014/08/13 02:31:30, sgurun wrote: > On 2014/08/13 01:32:08, bengr1 wrote: > > sgurun: android_webview ...
6 years, 4 months ago (2014-08-13 15:19:55 UTC) #20
bengr
The CQ bit was checked by bengr@chromium.org
6 years, 4 months ago (2014-08-14 00:28:57 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bengr@chromium.org/449973002/240001
6 years, 4 months ago (2014-08-14 00:32:52 UTC) #22
commit-bot: I haz the power
Committed patchset #7 (240001) as 289528
6 years, 4 months ago (2014-08-14 11:46:02 UTC) #23
Ryan Sleevi
6 years, 4 months ago (2014-08-14 19:19:51 UTC) #24
Message was sent while issue was closed.
Like Matt, I've found the ownership model very tricky here, and would like to
request some more documentation, as well as suggest some cleanups that should
make it easier to reason about.

I've taken a quick scan of this code, primarily for style/design issues, and
have not dug into the deeper, holistic review of this.

I found the description a bit confusing, at least in relationship to what you're
exposing. That is, I understand the description from the
//components/data_reduction_proxy perspective, but it's perhaps better to
separate out the //net changes, so that we can document how they can be used,
rather than how they are used. This helps us validate that the layering and
testing are at the right places.

I'm a little nervous that there may not be enough testing for the
NetworkDelegate - it feels like that's being outsourced to the user (data
reduction proxy) - rather than being part of the core interface support here. Do
we really have no unittests for the NetworkDelegate? That's quite unfortunate.

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.cc (right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.cc:437:
!proxy_config_getter_.is_null()) {
Is this correct? It now forces proxy_config_getter_ to be non-NULL, which isn't
documented in the header as being required (it suggests it's optional, by virtue
of having an extra setter)

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/chro...
File chrome/browser/net/chrome_network_delegate.h (right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/chro...
chrome/browser/net/chrome_network_delegate.h:85: // proxy resolution.
Having read through this header, and the related code, I'm still a little
confused as to what this hook is meant to provide/how to use this correctly.

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc
(right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc:78:
config.set_id(unused_id);
why not just set_id(1)? Why do you need to declare the local ID?

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc:83:
base::Unretained(this),
This is a very dangerous usage.

No where in the header are the lifetime requirements spelled out, so you have no
guarantee that this object ("this") will still be valid when this code executes
on the IO thread.

While you could spell it out with a comment, a better design would be to avoid
this requirement altogether.

That is, favour complexity *in* this class if it means you can *avoid*
complexity in users of this class (which lifetime management is often the
high-order bit of complexity)

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc:93:
dict->SetString("bypass_list", "");
cleanup: These should all be std::string() instead of ""

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc:100:
config));
Did git-cl-format do this? It seems odd for it.

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.cc:123:
void DataReductionProxyChromeConfigurator::UpdateProxyConfigOnIO(
If you decide to keep these methods (ideally, you wouldn't), you should add
DCHECKs to these methods to annotate throughout this class that asserts it's
used correctly

However, from looking at this (rather than just the header), it doesn't seem
necessary to
1) Expose these as public methods (as opposed to private)
2) Require they be methods on the class (rather, you could have a helper ::Core
class that lives entirely on the IO thread, and which the parent marshals
messages to/from)

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h
(right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:15: 
IWYU: You need to include "base/memory/ref_counted.h" to use scoped_refptr

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:32:
scoped_refptr<base::SequencedTaskRunner> network_task_runner);
This should be a const-ref scoped_refptr

scoped_ptr is the only class in Chrome that should be passed by value. All of
the rest should be const-ref or pointers.

(For scoped_refptr<>s, it means you're adding an additional AddRef/Release call
that isn't needed)

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h:54: //
Updates the config for use on the IO thread.
So, this generally represents a dangerous design patern, in that now it means
the DataReductionProxyChromeConfigurator lives on multiple threads.

The d_r_p:DRPC doesn't have this requirement, and you're exposing these methods
publicly, which makes it very easy to get ownership wrong.

Put differently, it bakes how this class is used into the design, which is
usually a sign of a layering violation occuring.

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc
(right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.cc:7: #include
"base/memory/scoped_ptr.h"
1) IWYU: This is no longer needed
2) IWYU: This was already included in the header so wasn't needed to begin with

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
File chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h
(right):

https://codereview.chromium.org/449973002/diff/240001/chrome/browser/net/spdy...
chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h:8: #include
"base/memory/scoped_ptr.h"
IWYU: This is no longer needed

https://codereview.chromium.org/449973002/diff/240001/net/base/network_delega...
File net/base/network_delegate.h (right):

https://codereview.chromium.org/449973002/diff/240001/net/base/network_delega...
net/base/network_delegate.h:135: // may override the decision by modifying the
ProxyInfo |result|.
Please update this documentation to reflect how proxy_service can and should be
used. I could not find documentation that spells it out, beyond the comments on
this review.

Powered by Google App Engine
This is Rietveld 408576698