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

Issue 338065: Add the ability for objects which derive from RefCountedThreadSafe to specify... (Closed)

Created:
11 years, 1 month ago by jam
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, brettw+cc_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

Add the ability for objects which derive from RefCountedThreadSafe to specify a destructor trait. This allows browser objects to specify which thread they're terminated on. The benefit is we avoid the need to do manual ref counting when an object posts tasks to itself on different threads, if an object must be destructed on a specific thread. This patch adds initial support and only shows one example with ResourceMessageFilter. I will do the rest in a follow-up patch to keep things small. BUG=25354 TEST=added unit tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30688

Patch Set 1 : '' #

Patch Set 2 : '' #

Patch Set 3 : Make IPC::ChannelProxy::MessageFilter not ref counted #

Patch Set 4 : Make MessageFilter be ref counted again #

Total comments: 5

Patch Set 5 : '' #

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+199 lines, -331 lines) Patch
M base/ref_counted.h View 1 2 3 4 5 3 chunks +26 lines, -3 lines 0 comments Download
M chrome/browser/chrome_thread.h View 1 2 3 4 1 chunk +29 lines, -0 lines 0 comments Download
M chrome/browser/chrome_thread_unittest.cc View 1 2 3 4 1 chunk +85 lines, -49 lines 0 comments Download
D chrome/browser/renderer_host/file_system_accessor.h View 1 2 3 4 1 chunk +0 lines, -74 lines 0 comments Download
D chrome/browser/renderer_host/file_system_accessor.cc View 1 2 3 4 1 chunk +0 lines, -44 lines 0 comments Download
D chrome/browser/renderer_host/file_system_accessor_unittest.cc View 1 2 3 4 1 chunk +0 lines, -115 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.h View 1 2 3 4 4 chunks +4 lines, -5 lines 0 comments Download
M chrome/browser/renderer_host/resource_message_filter.cc View 1 2 3 4 5 chunks +34 lines, -37 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 4 2 chunks +0 lines, -3 lines 0 comments Download
M ipc/ipc_channel_proxy.h View 1 2 3 4 2 chunks +15 lines, -1 line 0 comments Download
M ipc/ipc_channel_proxy.cc View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
jam
11 years, 1 month ago (2009-10-28 21:44:20 UTC) #1
darin (slow to review)
LGTM! http://codereview.chromium.org/338065/diff/9052/9069 File chrome/browser/chrome_thread.h (right): http://codereview.chromium.org/338065/diff/9052/9069#newcode142 Line 142: DeleteSoon(thread, FROM_HERE, x); unfortunately, the value of ...
11 years, 1 month ago (2009-10-30 19:57:59 UTC) #2
jam
11 years, 1 month ago (2009-10-30 23:08:50 UTC) #3
http://codereview.chromium.org/338065/diff/9052/9068
File chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h (right):

http://codereview.chromium.org/338065/diff/9052/9068#newcode50
Line 50: friend struct
On 2009/10/30 19:57:59, darin wrote:
> if we make DefaultRefCountedThreadSafeTraits call back to a static function on
> RefCountedThreadSafe that then does the delete call, then we can avoid
changing
> these friend declarations.

Done.

http://codereview.chromium.org/338065/diff/9052/9071
File chrome/browser/renderer_host/resource_message_filter.cc (right):

http://codereview.chromium.org/338065/diff/9052/9071#newcode410
Line 410: ChromeThread::DeleteOnIOThread::Destruct(this);
On 2009/10/30 19:57:59, darin wrote:
> nit: might be nice to use the more explicit:
> 
>   ChromeThread::DeleteSoon(ChromeThread::IO, FROM_HERE, this);

That would change the semantics a bit, since before the RMF would get deleted
right away if it's on the correct thread, but doing DeleteSoon would delay it
until the stack unwinds.  This could result in holding on to resources or memory
leaks in valgrind.

Powered by Google App Engine
This is Rietveld 408576698