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

Side by Side Diff: content/browser/browser_context.cc

Issue 10836293: Replace the DownloadFileManager with direct ownership of DownloadFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Take more direct control of location of destruction of Download Files. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/browser/browser_context.h" 5 #include "content/public/browser/browser_context.h"
6 6
7 #include "content/browser/appcache/chrome_appcache_service.h" 7 #include "content/browser/appcache/chrome_appcache_service.h"
8 #include "webkit/database/database_tracker.h" 8 #include "webkit/database/database_tracker.h"
9 #include "content/browser/dom_storage/dom_storage_context_impl.h" 9 #include "content/browser/dom_storage/dom_storage_context_impl.h"
10 #include "content/browser/download/download_file_manager.h"
11 #include "content/browser/download/download_manager_impl.h" 10 #include "content/browser/download/download_manager_impl.h"
12 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
13 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" 12 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
14 #include "content/public/browser/resource_context.h" 13 #include "content/public/browser/resource_context.h"
15 #include "content/browser/storage_partition.h" 14 #include "content/browser/storage_partition.h"
16 #include "content/browser/storage_partition_map.h" 15 #include "content/browser/storage_partition_map.h"
17 #include "content/common/child_process_host_impl.h" 16 #include "content/common/child_process_host_impl.h"
18 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/content_browser_client.h" 18 #include "content/public/browser/content_browser_client.h"
20 #include "net/base/server_bound_cert_service.h" 19 #include "net/base/server_bound_cert_service.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 109 }
111 110
112 } // namespace 111 } // namespace
113 112
114 DownloadManager* BrowserContext::GetDownloadManager( 113 DownloadManager* BrowserContext::GetDownloadManager(
115 BrowserContext* context) { 114 BrowserContext* context) {
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
117 if (!context->GetUserData(kDownloadManagerKeyName)) { 116 if (!context->GetUserData(kDownloadManagerKeyName)) {
118 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 117 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
119 DCHECK(rdh); 118 DCHECK(rdh);
120 DownloadFileManager* file_manager = rdh->download_file_manager();
121 DCHECK(file_manager);
122 scoped_refptr<DownloadManager> download_manager = 119 scoped_refptr<DownloadManager> download_manager =
123 new DownloadManagerImpl( 120 new DownloadManagerImpl(
124 file_manager,
125 scoped_ptr<DownloadItemFactory>(), 121 scoped_ptr<DownloadItemFactory>(),
126 GetContentClient()->browser()->GetNetLog()); 122 GetContentClient()->browser()->GetNetLog());
127 123
128 context->SetUserData( 124 context->SetUserData(
129 kDownloadManagerKeyName, 125 kDownloadManagerKeyName,
130 new UserDataAdapter<DownloadManager>(download_manager)); 126 new UserDataAdapter<DownloadManager>(download_manager));
131 download_manager->SetDelegate(context->GetDownloadManagerDelegate()); 127 download_manager->SetDelegate(context->GetDownloadManagerDelegate());
132 download_manager->Init(context); 128 download_manager->Init(context);
133 } 129 }
134 130
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 ForEachDOMStorageContext(browser_context, 253 ForEachDOMStorageContext(browser_context,
258 base::Bind(&DOMStorageContextImpl::PurgeMemory)); 254 base::Bind(&DOMStorageContextImpl::PurgeMemory));
259 } 255 }
260 256
261 BrowserContext::~BrowserContext() { 257 BrowserContext::~BrowserContext() {
262 if (GetUserData(kDownloadManagerKeyName)) 258 if (GetUserData(kDownloadManagerKeyName))
263 GetDownloadManager(this)->Shutdown(); 259 GetDownloadManager(this)->Shutdown();
264 } 260 }
265 261
266 } // namespace content 262 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698