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

Issue 6285002: Fix for crash when deleting DataSource's in IO thread. (Closed)

Created:
9 years, 11 months ago by ahendrickson
Modified:
9 years, 7 months ago
CC:
chromium-reviews, Randy Smith (Not in Mondays)
Visibility:
Public.

Description

Fix for crash when deleting |DataSource|s on the IO thread. Although |ChromeURLDataManager::DataSource|s are |RefCountedThreadSafe|, at least two derived classes contain |CancellationFlag| members, which check that they are deleted in the same thread as they are created. Normally, the |DataSource|s are destructed when |ChromeURLDataManager| (instanced via a Singleton) is destroyed, on the main thread. This is not an issue as the classes with a |CancellationFlag| are created on that thread too. However, occasionally (see the bug) |AddDataSource()| is called when there is already an entry in |data_sources_|, leading to a |DataSource| being released and destructed in the IO thread. To fix this problem, I've incremented the reference count and posted a task to the main (UI) thread that will release the reference and so destruct it there. BUG=49121 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=72398

Patch Set 1 #

Patch Set 2 : Removed debugging stack traces. #

Total comments: 2

Patch Set 3 : Now using the DeleteOnUIThread trait. #

Total comments: 4

Patch Set 4 : Minor cleanup. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -4 lines) Patch
M chrome/browser/dom_ui/chrome_url_data_manager.h View 1 2 3 3 chunks +7 lines, -3 lines 0 comments Download
M chrome/browser/dom_ui/chrome_url_data_manager.cc View 1 2 3 3 chunks +19 lines, -1 line 0 comments Download

Messages

Total messages: 8 (0 generated)
ahendrickson
9 years, 11 months ago (2011-01-14 17:43:58 UTC) #1
ahendrickson
Ping.
9 years, 11 months ago (2011-01-18 16:50:19 UTC) #2
eroman
This approach is fragile -- final reference to a refcounted class can be released from ...
9 years, 11 months ago (2011-01-19 22:47:01 UTC) #3
ahendrickson
http://codereview.chromium.org/6285002/diff/2001/chrome/browser/dom_ui/chrome_url_data_manager.cc File chrome/browser/dom_ui/chrome_url_data_manager.cc (right): http://codereview.chromium.org/6285002/diff/2001/chrome/browser/dom_ui/chrome_url_data_manager.cc#newcode8 chrome/browser/dom_ui/chrome_url_data_manager.cc:8: #include "base/debug/stack_trace.h" On 2011/01/19 22:47:01, eroman wrote: > Is ...
9 years, 11 months ago (2011-01-21 16:04:31 UTC) #4
eroman
lgtm http://codereview.chromium.org/6285002/diff/8001/chrome/browser/dom_ui/chrome_url_data_manager.cc File chrome/browser/dom_ui/chrome_url_data_manager.cc (right): http://codereview.chromium.org/6285002/diff/8001/chrome/browser/dom_ui/chrome_url_data_manager.cc#newcode203 chrome/browser/dom_ui/chrome_url_data_manager.cc:203: // |DataSource| now uses the |DeleteOnUIThread| trait. I ...
9 years, 11 months ago (2011-01-24 18:26:39 UTC) #5
ahendrickson
http://codereview.chromium.org/6285002/diff/8001/chrome/browser/dom_ui/chrome_url_data_manager.cc File chrome/browser/dom_ui/chrome_url_data_manager.cc (right): http://codereview.chromium.org/6285002/diff/8001/chrome/browser/dom_ui/chrome_url_data_manager.cc#newcode203 chrome/browser/dom_ui/chrome_url_data_manager.cc:203: // |DataSource| now uses the |DeleteOnUIThread| trait. On 2011/01/24 ...
9 years, 11 months ago (2011-01-24 19:58:20 UTC) #6
Nico
Hi guys, it looks like this caused many memory leaks ( http://crbug.com/70782 ). I guess ...
9 years, 11 months ago (2011-01-25 18:29:14 UTC) #7
ahendrickson
9 years, 11 months ago (2011-01-25 19:05:59 UTC) #8
I'm on it.

On 2011/01/25 18:29:14, Nico wrote:
> Hi guys, it looks like this caused many memory leaks ( http://crbug.com/70782
).
> I guess leaks are better than races, so unless I hear otherwise, I won't
revert
> this.

Powered by Google App Engine
This is Rietveld 408576698