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

Issue 14593012: BrowserContext should simply own DownloadManager (Closed)

Created:
7 years, 7 months ago by cmarcelo
Modified:
7 years, 7 months ago
CC:
chromium-reviews, asanka, benjhayden+dwatch_chromium.org, jam, joi+watch-content_chromium.org, darin-cc_chromium.org, stuartmorgan+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

BrowserContext should simply own DownloadManager This patch changes BrowserContext so it store a DownloadManager directly (as UserData), instead of storing a refptr to it. Client code (mostly tests) that used refptrs were changed to use either raw pointers (when they are only referencing) or to use scoped_ptr/ScopedVector in case of DownloadManagers created by them. In cases where DownloadManager was used with Bind() to create a callback, care was taken to make sure that we didn't get invalid callbacks -- we were protected from this before because DownloadManager was refcounted. The Bind() in DownloadManagerImpl::CheckForFileRemoval() is using a weak pointer to itself. The Bind() calls in DownloadTestObserver were changed to go first thru the object itself and then check whether the DownloadManager was still valid. Removed DownloadManager parameter from PluginInstaller::DownloadStarted() since it was not used anymore. BUG=237871 TEST=content_unittests and browser_tests filtered with Download\*

Patch Set 1 #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+101 lines, -126 lines) Patch
M chrome/browser/download/all_download_item_notifier_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/download_browsertest.cc View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/download/download_history_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/download_shelf_unittest.cc View 3 chunks +3 lines, -3 lines 2 comments Download
M chrome/browser/download/download_status_updater_unittest.cc View 7 chunks +9 lines, -9 lines 0 comments Download
M chrome/browser/download/download_ui_controller_unittest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/download/test_download_shelf.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/test_download_shelf.cc View 1 chunk +1 line, -1 line 2 comments Download
M chrome/browser/plugins/plugin_installer.h View 1 chunk +1 line, -3 lines 0 comments Download
M chrome/browser/plugins/plugin_installer.cc View 2 chunks +1 line, -5 lines 0 comments Download
M content/browser/browser_context.cc View 1 chunk +4 lines, -4 lines 0 comments Download
M content/browser/download/download_id_unittest.cc View 3 chunks +8 lines, -22 lines 0 comments Download
M content/browser/download/download_manager_impl.h View 3 chunks +4 lines, -4 lines 0 comments Download
M content/browser/download/download_manager_impl.cc View 2 chunks +3 lines, -2 lines 0 comments Download
content/browser/download/download_manager_impl_unittest.cc View 4 chunks +5 lines, -5 lines 0 comments Download
M content/public/browser/download_manager.h View 2 chunks +3 lines, -8 lines 0 comments Download
M content/public/test/download_test_observer.h View 4 chunks +11 lines, -6 lines 2 comments Download
M content/public/test/download_test_observer.cc View 6 chunks +33 lines, -34 lines 2 comments Download
M content/public/test/mock_download_manager.h View 2 chunks +1 line, -3 lines 0 comments Download
M content/public/test/test_file_error_injector.h View 3 chunks +3 lines, -4 lines 0 comments Download
M content/public/test/test_file_error_injector.cc View 2 chunks +3 lines, -4 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
cmarcelo
7 years, 7 months ago (2013-05-17 00:18:36 UTC) #1
Jói
I was about to ask you for background on this change but I see it's ...
7 years, 7 months ago (2013-05-17 03:05:36 UTC) #2
Bernhard Bauer
chrome/browser/plugins LGTM (I assume that's what you want me to look at?)
7 years, 7 months ago (2013-05-17 07:12:03 UTC) #3
benjhayden
https://codereview.chromium.org/14593012/diff/1/chrome/browser/download/download_shelf_unittest.cc File chrome/browser/download/download_shelf_unittest.cc (right): https://codereview.chromium.org/14593012/diff/1/chrome/browser/download/download_shelf_unittest.cc#newcode46 chrome/browser/download/download_shelf_unittest.cc:46: content::MockDownloadManager* download_manager_; Should this be a scoped_ptr? https://codereview.chromium.org/14593012/diff/1/chrome/browser/download/test_download_shelf.cc File ...
7 years, 7 months ago (2013-05-17 14:50:02 UTC) #4
cmarcelo
Thanks for the review. I'll break this in a couple of smaller pieces that will ...
7 years, 7 months ago (2013-05-20 15:22:06 UTC) #5
cmarcelo
7 years, 7 months ago (2013-05-23 19:58:06 UTC) #6
I split this patch in smaller patches. The last piece, which does the ownership
change, is now in https://codereview.chromium.org/15701007

Powered by Google App Engine
This is Rietveld 408576698