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

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed)

Created:
8 years, 6 months ago by jam
Modified:
8 years, 6 months ago
CC:
chromium-reviews, asanka, nkostylev+watch_chromium.org, achuith+watch_chromium.org, dcheng, stuartmorgan+watch_chromium.org, ajwong+watch_chromium.org, stevenjb+watch_chromium.org, kkania, joi+watch-content_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org, Andrei, Avi (use Gerrit), jennb, creis+watch_chromium.org, jochen+watch-content_chromium.org, Randy Smith (Not in Mondays), jianli, oshima+watch_chromium.org, mihaip-chromium-reviews_chromium.org, Dmitry Titov, Aaron Boodman, robertshield, rdsmith+dwatch_chromium.org, davemoore+watch_chromium.org, benjhayden, tfarina
Visibility:
Public.

Description

Move creation and ownership of DownloadManager from the embedder to content. This matches all the other objects that content depends on. In a followup change, I'll make content support NULL DownloadManagerDelegates to match the rest of the delegate interfaces. BUG=98716 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=140761

Patch Set 1 #

Total comments: 3

Patch Set 2 : #

Patch Set 3 : fix tests #

Patch Set 4 : fix mac unittest and cros build #

Patch Set 5 : content should shutdown DownloadManager #

Patch Set 6 : content should shutdown DownloadManager #

Patch Set 7 : content should shutdown DownloadManager #

Patch Set 8 : fix cros compile #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+213 lines, -183 lines) Patch
M chrome/browser/app_controller_mac.mm View 1 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/automation/testing_automation_provider.cc View 6 chunks +9 lines, -6 lines 0 comments Download
M chrome/browser/browsing_data_remover.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/gdata/gdata_system_service.cc View 1 2 3 4 5 6 7 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.cc View 1 2 3 4 5 6 3 chunks +10 lines, -4 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate_unittest.cc View 1 2 3 4 5 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/download/download_browsertest.cc View 5 chunks +4 lines, -6 lines 0 comments Download
M chrome/browser/download/download_extension_api.cc View 1 2 2 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/download/download_extension_test.cc View 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/download/download_prefs.cc View 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/download/download_service.h View 3 chunks +5 lines, -11 lines 0 comments Download
M chrome/browser/download/download_service.cc View 1 2 3 4 5 6 4 chunks +34 lines, -41 lines 5 comments Download
M chrome/browser/download/save_page_browsertest.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/crx_installer_browsertest.cc View 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/extensions/webstore_installer.cc View 4 chunks +6 lines, -3 lines 0 comments Download
M chrome/browser/plugin_installer.cc View 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/profiles/off_the_record_profile_impl.h View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/profiles/off_the_record_profile_impl.cc View 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/profiles/profile_impl.h View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/profiles/profile_impl.cc View 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/tab_contents/render_view_context_menu.cc View 3 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/ui/browser_close_browsertest.cc View 4 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/ui/panels/panel_browsertest.cc View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/downloads_dom_handler.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/downloads_ui.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/options2/browser_options_handler2.cc View 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/test/base/testing_profile.h View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/base/testing_profile.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/browser_context.cc View 1 2 3 4 4 chunks +22 lines, -0 lines 1 comment Download
M content/browser/download/download_manager_impl.h View 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/download/download_manager_impl.cc View 1 2 3 4 chunks +13 lines, -16 lines 0 comments Download
M content/browser/download/download_manager_impl_unittest.cc View 2 chunks +6 lines, -10 lines 0 comments Download
M content/browser/download/download_request_handle.cc View 2 chunks +2 lines, -1 line 0 comments Download
M content/browser/download/drag_download_file.cc View 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/download/save_package.cc View 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/renderer_host/resource_dispatcher_host_browsertest.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 2 chunks +3 lines, -1 line 0 comments Download
M content/public/browser/browser_context.h View 4 chunks +6 lines, -3 lines 3 comments Download
M content/public/browser/content_browser_client.h View 2 chunks +1 line, -2 lines 0 comments Download
M content/public/browser/download_manager.h View 1 2 3 4 5 1 chunk +5 lines, -5 lines 5 comments Download
M content/public/test/mock_download_manager.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/test/test_browser_context.h View 1 chunk +1 line, -1 line 0 comments Download
M content/shell/shell_browser_context.h View 3 chunks +1 line, -4 lines 0 comments Download
M content/shell/shell_browser_context.cc View 1 chunk +3 lines, -9 lines 0 comments Download
M content/test/test_browser_context.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13 (0 generated)
jam
(most of the changes are just changing how one gets a DownloadManager)
8 years, 6 months ago (2012-06-05 23:29:48 UTC) #1
Avi (use Gerrit)
http://codereview.chromium.org/10535026/diff/1/content/browser/browser_context.cc File content/browser/browser_context.cc (right): http://codereview.chromium.org/10535026/diff/1/content/browser/browser_context.cc#newcode142 content/browser/browser_context.cc:142: DownloadManager* BrowserContext::GetDownloadManager( This DCHECKs if you call it more ...
8 years, 6 months ago (2012-06-05 23:34:41 UTC) #2
Avi (use Gerrit)
http://codereview.chromium.org/10535026/diff/1/content/public/browser/browser_context.h File content/public/browser/browser_context.h (right): http://codereview.chromium.org/10535026/diff/1/content/public/browser/browser_context.h#newcode50 content/public/browser/browser_context.h:50: static DownloadManager* GetDownloadManager(BrowserContext* browser_context); My concern is that this ...
8 years, 6 months ago (2012-06-05 23:38:22 UTC) #3
jam
http://codereview.chromium.org/10535026/diff/1/content/browser/browser_context.cc File content/browser/browser_context.cc (right): http://codereview.chromium.org/10535026/diff/1/content/browser/browser_context.cc#newcode142 content/browser/browser_context.cc:142: DownloadManager* BrowserContext::GetDownloadManager( On 2012/06/05 23:34:41, Avi wrote: > This ...
8 years, 6 months ago (2012-06-05 23:47:15 UTC) #4
Avi (use Gerrit)
lgtm with nit http://codereview.chromium.org/10535026/diff/2090/content/browser/browser_context.cc File content/browser/browser_context.cc (right): http://codereview.chromium.org/10535026/diff/2090/content/browser/browser_context.cc#newcode144 content/browser/browser_context.cc:144: if(!context->GetUserData(kDownloadManagerKeyName)) { style nit: space between ...
8 years, 6 months ago (2012-06-06 14:49:44 UTC) #5
Randy Smith (Not in Mondays)
In process of doing a review but I think this is real, so sending this ...
8 years, 6 months ago (2012-06-06 15:35:52 UTC) #6
tfarina
https://chromiumcodereview.appspot.com/10535026/diff/2090/content/public/browser/download_manager.h File content/public/browser/download_manager.h (right): https://chromiumcodereview.appspot.com/10535026/diff/2090/content/public/browser/download_manager.h#newcode69 content/public/browser/download_manager.h:69: virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0; There is already ...
8 years, 6 months ago (2012-06-06 15:44:15 UTC) #7
jam
http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc File chrome/browser/download/download_service.cc (right): http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc#newcode30 chrome/browser/download/download_service.cc:30: DownloadManager* dm = BrowserContext::GetDownloadManager(profile_); On 2012/06/06 15:35:52, rdsmith wrote: ...
8 years, 6 months ago (2012-06-06 15:49:36 UTC) #8
Randy Smith (Not in Mondays)
A couple more comments, mostly about clarifying interface contracts. http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc File chrome/browser/download/download_service.cc (right): http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc#newcode38 chrome/browser/download/download_service.cc:38: ...
8 years, 6 months ago (2012-06-06 15:51:59 UTC) #9
jam
https://chromiumcodereview.appspot.com/10535026/diff/2090/content/public/browser/download_manager.h File content/public/browser/download_manager.h (right): https://chromiumcodereview.appspot.com/10535026/diff/2090/content/public/browser/download_manager.h#newcode69 content/public/browser/download_manager.h:69: virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0; On 2012/06/06 15:44:15, ...
8 years, 6 months ago (2012-06-06 15:53:04 UTC) #10
jam
http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc File chrome/browser/download/download_service.cc (right): http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/download_service.cc#newcode38 chrome/browser/download/download_service.cc:38: DownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() { On 2012/06/06 15:51:59, rdsmith wrote: > ...
8 years, 6 months ago (2012-06-06 16:06:14 UTC) #11
Timur Iskhodzhanov
Valgrind is barking on a leak report http://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20Tests%20%28valgrind%29%282%29/builds/10851/steps/memory%20test%3A%20safe_browsing/logs/stdio Mind taking a look?
8 years, 6 months ago (2012-06-06 16:07:07 UTC) #12
Randy Smith (Not in Mondays)
8 years, 6 months ago (2012-06-06 16:34:45 UTC) #13
http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/dow...
File chrome/browser/download/download_service.cc (right):

http://codereview.chromium.org/10535026/diff/2090/chrome/browser/download/dow...
chrome/browser/download/download_service.cc:30: DownloadManager* dm =
BrowserContext::GetDownloadManager(profile_);
On 2012/06/06 15:49:36, John Abd-El-Malek wrote:
> On 2012/06/06 15:35:52, rdsmith wrote:
> > This looks like it will unilaterally create a download manager whenever
> > OnManagerCreated is called.  This is a behavior we were trying to
> avoid--there's
> > a fair amount of machinery (spec. reading in old downloads, of which there
are
> > sometimes a metric ton in the history) that gets invoked when a download
> manager
> > is created, and it's not needed for every browser invocation.  Am I wrong? 
If
> > not, can we keep the old semantics somehow?
> 
> my bad, I meant to call GetDownloadManager in the if statement. I'll send you
a
> fix.

Cool, thanks.  I'll probably ask Ben to review it :-} (which I suspect will give
you shorter turn around time).

http://codereview.chromium.org/10535026/diff/2090/content/public/browser/brow...
File content/public/browser/browser_context.h (right):

http://codereview.chromium.org/10535026/diff/2090/content/public/browser/brow...
content/public/browser/browser_context.h:108: virtual DownloadManagerDelegate*
GetDownloadManagerDelegate() = 0;
On 2012/06/06 16:06:15, John Abd-El-Malek wrote:
> On 2012/06/06 15:51:59, rdsmith wrote:
> > What's the conceptual reason for not having the DownloadManager accessible
> from
> > the BrowserContext?
> 
> The reason is that BrowserContext is an interface that the embedder
implements.
> When we started the chrome/content split, chrome still had to provide DM and a
> lot of other classes (see lines 51-60 above). This places a lot of burden on
> embedders to create these objects in the right order etc. The goal has been to
> make embedding content easier, so we've moved ownership/creation of any object
> that content needs to content.
> 
> So now since content creates this object, we don't want to ask the embedder
for
> something that content created. That, and also to follow the content API's
> convention of having the embedder interfaces not have any implementations.

Makes sense; thanks for the explanation.

> 
> > My naive reading of the code makes it look like the
> > BrowserContext owns the DM now, and the DM is a content level concept, 
> 
> correct
> 
> > unlike
> > the DMD, which is an content/embedder interface concept.
> 
> right, for now DMD is owned by the embedder. we can change this if you like.

Nope, that seems fine to me as long as we document it properly.

> > 
> > (Asking not because I'm wanting this to change, but because I don't think
I'll
> > be able to do a good review without understanding it.)
>

Powered by Google App Engine
This is Rietveld 408576698