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

Issue 6479007: Attempt 3 at: Splits ChromeURLDataManager into 2 chunks:... (Closed)

Created:
9 years, 10 months ago by sky
Modified:
9 years, 5 months ago
CC:
chromium-reviews, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, ncarter (slow), simonmorris+watch_chromium.org, idana, wez+watch_chromium.org, Raghu Simha, Erik does not do reviews, Paweł Hajdan Jr., dmaclach+watch_chromium.org, cbentzel+watch_chromium.org, garykac+watch_chromium.org, Aaron Boodman, darin-cc_chromium.org, lambroslambrou+watch_chromium.org, pam+watch_chromium.org, tim (not reviewing), ajwong+watch_chromium.org, brettw-cc_chromium.org, sergeyu+watch_chromium.org, davemoore+watch_chromium.org
Visibility:
Public.

Description

Attempt 3 at: Splits ChromeURLDataManager into 2 chunks: . ChromeURLDataManager is no longer a singleton and is always used on the UI thread. ChromeURLDataManager is now profile specific (you get from the profile). . ChromeURLDataManagerBackend handles the URLRequests and the DataSources. ChromeURLDataManagerBackend is created by ChromeURLRequestContext. All DataSources are now profile specific. There were two that wanted to be global, but have been converted. This differs from the last version in that DataSource::SendResponse does nothing if the DataSource is schedule for deletion. This is necessary otherwise SendResponse will up the ref count and by the time the request is processed on the IO thread chances are the DataSource will have been deleted. And if it wasn't deleted, it'll get scheduled for deletion again. <insert comment here about the perils of using delayed deletion> This has always been possible, it just appears to be more likely with my patch. BUG=52022 71868 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=74432

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 1

Patch Set 4 : '' #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+462 lines, -1126 lines) Patch
M chrome/browser/browser_about_handler.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_about_handler.cc View 4 chunks +3 lines, -24 lines 0 comments Download
M chrome/browser/browser_about_handler_unittest.cc View 2 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/browser_main.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/browser_shutdown.cc View 1 chunk +1 line, -6 lines 0 comments Download
M chrome/browser/browser_signin.cc View 1 chunk +5 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/imageburner_ui.cc View 1 chunk +1 line, -6 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/keyboard_overlay_ui.cc View 2 chunks +3 lines, -6 lines 0 comments Download
MM chrome/browser/chromeos/dom_ui/login/login_ui.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/menu_ui.cc View 3 chunks +4 lines, -12 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/mobile_setup_ui.cc View 1 chunk +1 line, -6 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/network_menu_ui.cc View 2 chunks +3 lines, -7 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/register_page_ui.cc View 2 chunks +2 lines, -6 lines 0 comments Download
M chrome/browser/chromeos/dom_ui/system_info_ui.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/bookmarks_ui.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/bug_report_ui.cc View 5 chunks +8 lines, -21 lines 0 comments Download
M chrome/browser/dom_ui/chrome_url_data_manager.h View 1 2 5 chunks +76 lines, -94 lines 1 comment Download
M chrome/browser/dom_ui/chrome_url_data_manager.cc View 1 2 3 2 chunks +96 lines, -399 lines 2 comments Download
A + chrome/browser/dom_ui/chrome_url_data_manager_backend.h View 2 chunks +33 lines, -125 lines 0 comments Download
A + chrome/browser/dom_ui/chrome_url_data_manager_backend.cc View 16 chunks +69 lines, -152 lines 0 comments Download
M chrome/browser/dom_ui/conflicts_ui.cc View 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/dom_ui/downloads_dom_handler.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/downloads_ui.cc View 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/dom_ui/filebrowse_ui.cc View 2 chunks +3 lines, -12 lines 0 comments Download
M chrome/browser/dom_ui/flags_ui.cc View 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/dom_ui/gpu_internals_ui.cc View 3 chunks +5 lines, -8 lines 0 comments Download
M chrome/browser/dom_ui/history2_ui.cc View 2 chunks +4 lines, -12 lines 0 comments Download
M chrome/browser/dom_ui/history_ui.cc View 2 chunks +5 lines, -13 lines 0 comments Download
M chrome/browser/dom_ui/keyboard_ui.cc View 2 chunks +2 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/mediaplayer_ui.cc View 2 chunks +4 lines, -12 lines 0 comments Download
M chrome/browser/dom_ui/most_visited_handler.cc View 1 chunk +10 lines, -19 lines 0 comments Download
M chrome/browser/dom_ui/net_internals_ui.cc View 2 chunks +5 lines, -10 lines 0 comments Download
M chrome/browser/dom_ui/new_tab_ui.cc View 2 chunks +4 lines, -13 lines 0 comments Download
M chrome/browser/dom_ui/options/browser_options_handler.cc View 1 chunk +2 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/options/options_ui.cc View 1 chunk +4 lines, -14 lines 0 comments Download
M chrome/browser/dom_ui/plugins_ui.cc View 1 chunk +1 line, -5 lines 0 comments Download
M chrome/browser/dom_ui/print_preview_ui.cc View 2 chunks +3 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/remoting_ui.cc View 2 chunks +3 lines, -5 lines 0 comments Download
MM chrome/browser/dom_ui/shared_resources_data_source.h View 2 chunks +1 line, -3 lines 0 comments Download
M chrome/browser/dom_ui/shared_resources_data_source.cc View 1 chunk +0 lines, -11 lines 0 comments Download
M chrome/browser/dom_ui/slideshow_ui.cc View 2 chunks +4 lines, -13 lines 0 comments Download
M chrome/browser/dom_ui/sync_internals_ui.cc View 1 chunk +2 lines, -6 lines 0 comments Download
M chrome/browser/dom_ui/textfields_ui.cc View 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 chunk +1 line, -5 lines 0 comments Download
M chrome/browser/extensions/extensions_ui.cc View 1 chunk +1 line, -6 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.h View 3 chunks +4 lines, -0 lines 0 comments Download
M chrome/browser/net/chrome_url_request_context.cc View 2 chunks +8 lines, -0 lines 0 comments Download
M chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc View 1 chunk +2 lines, -5 lines 0 comments Download
M chrome/browser/profiles/profile.h View 2 chunks +4 lines, -1 line 0 comments Download
M chrome/browser/profiles/profile.cc View 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/profiles/profile_impl.h View 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/profiles/profile_impl.cc View 2 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/remoting/setup_flow.cc View 1 chunk +4 lines, -6 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_mock.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/sync/sync_setup_wizard.cc View 1 chunk +4 lines, -9 lines 0 comments Download
MM chrome/browser/sync/sync_ui_util_unittest.cc View 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/render_view_host_manager_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/test/testing_profile.h View 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/test/testing_profile.cc View 3 chunks +8 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
sky
I'm hoping 3 is the lucky number! -Scott
9 years, 10 months ago (2011-02-10 03:25:23 UTC) #1
sky
Forgot to mention, patchset 1 is last patchset you reviewed. This crash was being triggered ...
9 years, 10 months ago (2011-02-10 03:30:01 UTC) #2
willchan no longer on Chromium
LGTM, even though it's ugly. http://codereview.chromium.org/6479007/diff/7012/chrome/browser/dom_ui/chrome_url_data_manager.cc File chrome/browser/dom_ui/chrome_url_data_manager.cc (right): http://codereview.chromium.org/6479007/diff/7012/chrome/browser/dom_ui/chrome_url_data_manager.cc#newcode122 chrome/browser/dom_ui/chrome_url_data_manager.cc:122: if (IsScheduledForDeletion(this)) { If ...
9 years, 10 months ago (2011-02-10 03:51:36 UTC) #3
Lei Zhang
http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome_url_data_manager.h File chrome/browser/dom_ui/chrome_url_data_manager.h (right): http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome_url_data_manager.h#newcode56 chrome/browser/dom_ui/chrome_url_data_manager.h:56: // data race. The |DeleteOnUIThread| trait is used to ...
9 years, 9 months ago (2011-03-04 12:30:55 UTC) #4
sky
Certainly. http://codereview.chromium.org/6624019/ is sent your way. -Scott On Fri, Mar 4, 2011 at 4:30 AM, ...
9 years, 9 months ago (2011-03-04 16:22:06 UTC) #5
joth
A late drive-by comment that I noticed whilst looking into something else (http://codereview.chromium.org/7489044/) Let me ...
9 years, 5 months ago (2011-07-25 11:39:04 UTC) #6
sky
http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome_url_data_manager.cc File chrome/browser/dom_ui/chrome_url_data_manager.cc (right): http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome_url_data_manager.cc#newcode122 chrome/browser/dom_ui/chrome_url_data_manager.cc:122: if (IsScheduledForDeletion(this)) { On 2011/07/25 11:39:04, joth wrote: > ...
9 years, 5 months ago (2011-07-25 14:20:26 UTC) #7
joth
On 25 July 2011 15:20, <sky@chromium.org> wrote: > > http://codereview.chromium.**org/6479007/diff/5025/chrome/** > browser/dom_ui/chrome_url_**data_manager.cc<http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome_url_data_manager.cc> > File chrome/browser/dom_ui/chrome_**url_data_manager.cc ...
9 years, 5 months ago (2011-07-25 14:58:36 UTC) #8
sky
9 years, 5 months ago (2011-07-25 15:48:11 UTC) #9
On Mon, Jul 25, 2011 at 7:58 AM, Jonathan Dixon <joth@chromium.org> wrote:
>
>
> On 25 July 2011 15:20, <sky@chromium.org> wrote:
>>
>>
>>
http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome...
>> File chrome/browser/dom_ui/chrome_url_data_manager.cc (right):
>>
>>
>>
http://codereview.chromium.org/6479007/diff/5025/chrome/browser/dom_ui/chrome...
>> chrome/browser/dom_ui/chrome_url_data_manager.cc:122: if
>> (IsScheduledForDeletion(this)) {
>> On 2011/07/25 11:39:04, joth wrote:
>>>
>>> This doesn't seem quite sufficient? Between this function returning
>>
>> 'true' and
>>>
>>> the PostTask being executed, another thread could still jump in
>>
>> decrement the
>>>
>>> refcount, and schedule this data source for deletion.
>>
>>> Afraid I can't really propose any fix to that other than avoid
>>
>> SendResponse
>>>
>>> being called on a data source when the reference maybe about to go
>>
>> away on it.
>>
>> This is a problem with any delayed deletion.
>>
>> I don't have a good idea on how to protect this either. In general the
>> DataSources are deleted on the same thread that SendResponse is going to
>> be invoked on, but there is nothing guaranteeing that. I also don't know
>> if that's true of all implementations.
>>
> I think what confuses me is, if the refcount has reached zero then logically
> there should be no 'owning' pointers (scoped_refptr) pointing at this
> object. In which case the caller is calling SendResponse via a raw pointer
> (either the object calling it on itself via 'this', or some other raw
> pointer). Could this be the error? How could we detect it?

I don't know if there are cases an object keeping the raw pointer
around, but there are definitely cases of the object itself trying to
invoke Send when the refcount hits 0. This happens with requests for
data from history. They schedule something on the history thread from
start, and only cancel that request from the destructor. This
necessitated the code in
ChromeURLDataManager::DataSource::SendResponse.

Even if we didn't have delayed deletion, the issue you mention would
still be a problem, but instead of hitting DCHECKs, it would likely
cause a crash.

  -Scott

Powered by Google App Engine
This is Rietveld 408576698