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

Issue 165430: Reference count ProxyService.... (Closed)

Created:
11 years, 4 months ago by eroman
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), willchan no longer on Chromium, Ben Goodger (Google)
Visibility:
Public.

Description

Reference count ProxyService. This is necessary since ProxyService is getting shared between chrome's url request contexts (off the record, media), and the current way it is being shared could result in free memory read/writes during shutdown. This is a step towards fixing http://crbug.com/15289. BUG=http://crbug.com/15289 TEST=The existing tests should continue to pass following this refactor. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=23612

Patch Set 1 #

Patch Set 2 : Remove another manual delete #

Patch Set 3 : Update a comment #

Patch Set 4 : add missing files #

Patch Set 5 : Add another file #

Total comments: 15

Patch Set 6 : Address willchan's comments #

Patch Set 7 : Reword something #

Patch Set 8 : sync #

Patch Set 9 : Add another unittest file that needs editing #

Patch Set 10 : Re-upload because i'm paranoid #

Patch Set 11 : Sync #

Unified diffs Side-by-side diffs Delta from patch set Stats (+217 lines, -205 lines) Patch
M chrome/browser/net/chrome_url_request_context.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +10 lines, -7 lines 0 comments Download
M chrome/browser/net/resolve_proxy_msg_helper.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/net/resolve_proxy_msg_helper_unittest.cc View 9 10 3 chunks +9 lines, -6 lines 0 comments Download
M net/http/http_network_layer.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -4 lines 0 comments Download
M net/http/http_network_layer.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -2 lines 0 comments Download
M net/http/http_network_layer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -6 lines 0 comments Download
M net/http/http_network_session.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -3 lines 0 comments Download
M net/http/http_network_transaction_unittest.cc View 1 2 3 4 5 6 7 8 9 10 7 chunks +12 lines, -17 lines 0 comments Download
M net/proxy/proxy_script_fetcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download
M net/proxy/proxy_service.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -3 lines 0 comments Download
M net/proxy/proxy_service.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M net/proxy/proxy_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 52 chunks +160 lines, -143 lines 0 comments Download
M net/tools/fetch/fetch_client.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -3 lines 0 comments Download
M net/url_request/url_request_context.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -5 lines 0 comments Download
M net/url_request/url_request_unittest.h View 4 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download
M net/url_request/url_request_unittest.cc View 4 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download
M webkit/tools/test_shell/test_shell_request_context.cc View 5 6 7 8 9 10 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
eroman
11 years, 4 months ago (2009-08-13 03:23:58 UTC) #1
willchan no longer on Chromium
LGTM, mod a few nits. http://codereview.chromium.org/165430/diff/77/1077 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/165430/diff/77/1077#newcode203 Line 203: // profile... This ...
11 years, 4 months ago (2009-08-13 19:06:17 UTC) #2
eroman
http://codereview.chromium.org/165430/diff/77/1077 File chrome/browser/net/chrome_url_request_context.cc (right): http://codereview.chromium.org/165430/diff/77/1077#newcode203 Line 203: // profile... On 2009/08/13 19:06:17, willchan wrote: > ...
11 years, 4 months ago (2009-08-14 00:56:48 UTC) #3
willchan no longer on Chromium
Still LGTM, although I'd like to understand why this needs to be thread safe ref ...
11 years, 4 months ago (2009-08-14 03:52:27 UTC) #4
eroman
http://codereview.chromium.org/165430/diff/77/1076 File chrome/browser/net/resolve_proxy_msg_helper.h (right): http://codereview.chromium.org/165430/diff/77/1076#newcode87 Line 87: scoped_refptr<net::ProxyService> proxy_service_; On 2009/08/14 03:52:27, willchan wrote: > ...
11 years, 4 months ago (2009-08-14 04:18:39 UTC) #5
willchan no longer on Chromium
11 years, 4 months ago (2009-08-14 04:20:54 UTC) #6
http://codereview.chromium.org/165430/diff/77/1076
File chrome/browser/net/resolve_proxy_msg_helper.h (right):

http://codereview.chromium.org/165430/diff/77/1076#newcode87
Line 87: scoped_refptr<net::ProxyService> proxy_service_;
On 2009/08/14 04:18:39, eroman wrote:
> On 2009/08/14 03:52:27, willchan wrote:
> > On 2009/08/14 00:56:48, eroman wrote:
> > > On 2009/08/13 19:06:17, willchan wrote:
> > > > - nits: you should be #include'ing "base/ref_counted.h" for this.  My
> guess
> > is
> > > > you're pulling this in transitively through #include
> > > > "net/proxy/proxy_service.h".  I took a brief glance and don't see why
that
> > > > include is necessary.  Can we switch that to a forward declare too?  Or
> will
> > > > that require a ton of changes (I'm not sure if anyone else is depending
on
> > the
> > > > transitive include too).
> > > 
> > > Added an include for "base/ref_counted.h".
> > > 
> > > I don't quite understand the second ask -- proxy_service.h needs to
include
> > > ref_counted.h since it inherits from RefCounted.
> > > 
> > > In fact really, it should inherit RefCountedThreadSafe; fixed.
> > 
> > Er, but this file (resolve_proxy_msg_helper.h) doesn't need to #include
> > "net/proxy/proxy_service.h", does it?
> 
> Oh, thats what you meant!
> Yeah sure, I will forward declare ProxyService instead of including the
header.
> 
> > 
> > Also, why does it need to be thread safe?  What other thread is accessing
the
> > ProxyService?
> 
> So what concerns me is that URLRequestContexts are created lazily on the UI
> thread (by the Profile).
> 
> So lets say the original context gets created (UI thread) during startup, then
> the IO thread is spawned and starts processing requests. So far things are
> peachy.
> 
> Now the user Foo opens up an incognito window .. this creates an OTR profile
on
> the UI thread, which in turn creates a ChromeURLRequestContext, which in turn
> does proxy_service_ = original_context->proxy_service()... In fact what it is
> doing here is calling AddRef.  Since some dude could be calling AddRef at the
> same time on IO thread it needs to be atomic so as not to bleed any refcounts.

Ugh!  We really should just create the ChromeURLRequestContext on the IO thread
:(  Ok, makes sense to me then.

Powered by Google App Engine
This is Rietveld 408576698