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

Issue 3869003: Const-ify RefCountedThreadSafe::AddRef and Release. (Closed)

Created:
10 years, 2 months ago by Matt Perry
Modified:
9 years, 7 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, jam, cbentzel+watch_chromium.org, ben+cc_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr., Raghu Simha, amit, ncarter (slow), idana, tim (not reviewing)
Visibility:
Public.

Description

Const-ify RefCountedThreadSafe::AddRef and Release. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=63457

Patch Set 1 #

Patch Set 2 : const_cast #

Patch Set 3 : constify Destruct #

Patch Set 4 : mutable #

Patch Set 5 : compile fix #

Patch Set 6 : compile fixes #

Patch Set 7 : more compile fixes #

Total comments: 5

Patch Set 8 : GetIOMessageLoop #

Patch Set 9 : more consts #

Patch Set 10 : actually remove the cast #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -53 lines) Patch
M base/message_loop.h View 2 chunks +3 lines, -2 lines 0 comments Download
M base/message_loop_proxy.h View 1 chunk +2 lines, -2 lines 0 comments Download
M base/message_loop_proxy.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/message_loop_proxy_impl.h View 3 2 chunks +2 lines, -2 lines 0 comments Download
M base/message_loop_proxy_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M base/message_loop_proxy_impl_unittest.cc View 2 chunks +5 lines, -5 lines 0 comments Download
M base/ref_counted.h View 1 2 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M base/task.h View 3 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/browser_thread.h View 3 4 5 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/browser_thread_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/chrome_plugin_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/net/chrome_url_request_context.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/net/chrome_url_request_context.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/pepper_file_message_filter.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/pepper_file_message_filter.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/http_bridge.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/http_bridge.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/glue/http_bridge_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/net/url_fetcher_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/common/net/url_request_context_getter.h View 3 4 5 6 7 4 chunks +5 lines, -4 lines 0 comments Download
M chrome/common/net/url_request_context_getter.cc View 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chrome/service/net/service_url_request_context.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/service/net/service_url_request_context.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/test/testing_profile.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome_frame/metrics_service.cc View 1 chunk +1 line, -1 line 0 comments Download
M ipc/ipc_channel_proxy.h View 1 chunk +2 lines, -2 lines 0 comments Download
M ipc/ipc_channel_proxy.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (0 generated)
Matt Perry
10 years, 2 months ago (2010-10-20 18:10:07 UTC) #1
willchan no longer on Chromium
lgtm
10 years, 2 months ago (2010-10-20 18:12:48 UTC) #2
Matt Perry
It failed to compile. I had to add a const_cast to the pointer since the ...
10 years, 2 months ago (2010-10-20 18:53:09 UTC) #3
willchan no longer on Chromium
On Wed, Oct 20, 2010 at 11:53 AM, <mpcomplete@chromium.org> wrote: > It failed to compile. ...
10 years, 2 months ago (2010-10-20 20:50:12 UTC) #4
Matt Perry
On 2010/10/20 20:50:12, willchan wrote: > On Wed, Oct 20, 2010 at 11:53 AM, <mailto:mpcomplete@chromium.org> ...
10 years, 2 months ago (2010-10-20 21:51:09 UTC) #5
willchan no longer on Chromium
On Wed, Oct 20, 2010 at 2:51 PM, <mpcomplete@chromium.org> wrote: > On 2010/10/20 20:50:12, willchan ...
10 years, 2 months ago (2010-10-20 22:01:34 UTC) #6
Matt Perry
On 2010/10/20 22:01:34, willchan wrote: > > Hmm.. maybe. I'm unfamiliar with this code, so ...
10 years, 2 months ago (2010-10-20 22:23:31 UTC) #7
Matt Perry
I've updated the CL again to fix some compile issues. const is spreading like the ...
10 years, 2 months ago (2010-10-20 22:41:47 UTC) #8
willchan no longer on Chromium
LGTM http://codereview.chromium.org/3869003/diff/23001/24010 File chrome/browser/browser_thread_unittest.cc (right): http://codereview.chromium.org/3869003/diff/23001/24010#newcode80 chrome/browser/browser_thread_unittest.cc:80: mutable MessageLoop loop_; Ew, this is broken. But ...
10 years, 2 months ago (2010-10-21 20:37:39 UTC) #9
Matt Perry
http://codereview.chromium.org/3869003/diff/23001/24010 File chrome/browser/browser_thread_unittest.cc (right): http://codereview.chromium.org/3869003/diff/23001/24010#newcode80 chrome/browser/browser_thread_unittest.cc:80: mutable MessageLoop loop_; On 2010/10/21 20:37:39, willchan wrote: > ...
10 years, 2 months ago (2010-10-21 21:31:21 UTC) #10
willchan no longer on Chromium
http://codereview.chromium.org/3869003/diff/23001/24010 File chrome/browser/browser_thread_unittest.cc (right): http://codereview.chromium.org/3869003/diff/23001/24010#newcode80 chrome/browser/browser_thread_unittest.cc:80: mutable MessageLoop loop_; On 2010/10/21 21:31:21, Matt Perry wrote: ...
10 years, 2 months ago (2010-10-21 21:45:25 UTC) #11
Matt Perry
On 2010/10/21 21:45:25, willchan wrote: > http://codereview.chromium.org/3869003/diff/23001/24010 > File chrome/browser/browser_thread_unittest.cc (right): > > http://codereview.chromium.org/3869003/diff/23001/24010#newcode80 > ...
10 years, 2 months ago (2010-10-21 21:55:58 UTC) #12
willchan no longer on Chromium
10 years, 2 months ago (2010-10-21 22:02:46 UTC) #13
On 2010/10/21 21:55:58, Matt Perry wrote:
> On 2010/10/21 21:45:25, willchan wrote:
> > http://codereview.chromium.org/3869003/diff/23001/24010
> > File chrome/browser/browser_thread_unittest.cc (right):
> > 
> > http://codereview.chromium.org/3869003/diff/23001/24010#newcode80
> > chrome/browser/browser_thread_unittest.cc:80: mutable MessageLoop loop_;
> > On 2010/10/21 21:31:21, Matt Perry wrote:
> > > On 2010/10/21 20:37:39, willchan wrote:
> > > > Ew, this is broken.  But I don't know that I have the heart to ask you
to
> > fix
> > > > it, especially since it's so benign.  I think it's fine, but you should
> > > document
> > > > in a comment that this should be fixed.
> > > 
> > > Is it? MessageLoop::PostTask is non-const, but it actually does modify its
> > > members (incoming_queue_). Are you proposing that those members should be
> > > mutable?
> > 
> > I'm not suggesting the brokenness is in MessageLoop::PostTask().  I'm saying
> > it's here, in BrowserThreadTest.  Release() shouldn't be tried to call a
> > non-const function on a member variable.
> > 
> > Actually, looking at this now, shouldn't we be able to just call
> > MessageLoop::current()->PostTask() instead of loop_.PostTask()?  Then loop_
> > doesn't need to be mutable.
> 
> I see. We might be able to use current(), but that just seems like cheating to
> me. It's accessing the same variable, just in a roundabout way. I don't really
> like any of the options though... they all seem broken in some way. 'mutable'
> seems to at least be the clearest about what's going on.

Well, the other way to fix it is to simply post the QuitTask the test body
before calling Run().  Since it'll run after the Release() function is invoked,
it should Quit() appropriately.

This is a nit, so don't feel like you have to hold yourself up on my comments
here, but I think mutable is suboptimal in this case.

Powered by Google App Engine
This is Rietveld 408576698