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

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

Issue 1008613002: favor DCHECK_CURRENTLY_ON for better logs in content/browser/[a-d]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
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 #if !defined(OS_IOS) 7 #if !defined(OS_IOS)
8 #include "content/browser/download/download_manager_impl.h" 8 #include "content/browser/download/download_manager_impl.h"
9 #include "content/browser/fileapi/chrome_blob_storage_context.h" 9 #include "content/browser/fileapi/chrome_blob_storage_context.h"
10 #include "content/browser/indexed_db/indexed_db_context_impl.h" 10 #include "content/browser/indexed_db/indexed_db_context_impl.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void BrowserContext::GarbageCollectStoragePartitions( 106 void BrowserContext::GarbageCollectStoragePartitions(
107 BrowserContext* browser_context, 107 BrowserContext* browser_context,
108 scoped_ptr<base::hash_set<base::FilePath> > active_paths, 108 scoped_ptr<base::hash_set<base::FilePath> > active_paths,
109 const base::Closure& done) { 109 const base::Closure& done) {
110 GetStoragePartitionMap(browser_context)->GarbageCollect( 110 GetStoragePartitionMap(browser_context)->GarbageCollect(
111 active_paths.Pass(), done); 111 active_paths.Pass(), done);
112 } 112 }
113 113
114 DownloadManager* BrowserContext::GetDownloadManager( 114 DownloadManager* BrowserContext::GetDownloadManager(
115 BrowserContext* context) { 115 BrowserContext* context) {
116 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 116 DCHECK_CURRENTLY_ON(BrowserThread::UI);
117 if (!context->GetUserData(kDownloadManagerKeyName)) { 117 if (!context->GetUserData(kDownloadManagerKeyName)) {
118 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 118 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
119 DCHECK(rdh); 119 DCHECK(rdh);
120 DownloadManager* download_manager = 120 DownloadManager* download_manager =
121 new DownloadManagerImpl( 121 new DownloadManagerImpl(
122 GetContentClient()->browser()->GetNetLog(), context); 122 GetContentClient()->browser()->GetNetLog(), context);
123 123
124 context->SetUserData( 124 context->SetUserData(
125 kDownloadManagerKeyName, 125 kDownloadManagerKeyName,
126 download_manager); 126 download_manager);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 StoragePartition* BrowserContext::GetDefaultStoragePartition( 204 StoragePartition* BrowserContext::GetDefaultStoragePartition(
205 BrowserContext* browser_context) { 205 BrowserContext* browser_context) {
206 return GetStoragePartition(browser_context, NULL); 206 return GetStoragePartition(browser_context, NULL);
207 } 207 }
208 208
209 // static 209 // static
210 void BrowserContext::CreateMemoryBackedBlob(BrowserContext* browser_context, 210 void BrowserContext::CreateMemoryBackedBlob(BrowserContext* browser_context,
211 const char* data, size_t length, 211 const char* data, size_t length,
212 const BlobCallback& callback) { 212 const BlobCallback& callback) {
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 213 DCHECK_CURRENTLY_ON(BrowserThread::UI);
214 214
215 ChromeBlobStorageContext* blob_context = 215 ChromeBlobStorageContext* blob_context =
216 ChromeBlobStorageContext::GetFor(browser_context); 216 ChromeBlobStorageContext::GetFor(browser_context);
217 BrowserThread::PostTaskAndReplyWithResult( 217 BrowserThread::PostTaskAndReplyWithResult(
218 BrowserThread::IO, FROM_HERE, 218 BrowserThread::IO, FROM_HERE,
219 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob, 219 base::Bind(&ChromeBlobStorageContext::CreateMemoryBackedBlob,
220 make_scoped_refptr(blob_context), data, length), 220 make_scoped_refptr(blob_context), data, length),
221 callback); 221 callback);
222 } 222 }
223 223
224 // static 224 // static
225 void BrowserContext::CreateFileBackedBlob( 225 void BrowserContext::CreateFileBackedBlob(
226 BrowserContext* browser_context, 226 BrowserContext* browser_context,
227 const base::FilePath& path, 227 const base::FilePath& path,
228 int64_t offset, 228 int64_t offset,
229 int64_t size, 229 int64_t size,
230 const base::Time& expected_modification_time, 230 const base::Time& expected_modification_time,
231 const BlobCallback& callback) { 231 const BlobCallback& callback) {
232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 232 DCHECK_CURRENTLY_ON(BrowserThread::UI);
233 233
234 ChromeBlobStorageContext* blob_context = 234 ChromeBlobStorageContext* blob_context =
235 ChromeBlobStorageContext::GetFor(browser_context); 235 ChromeBlobStorageContext::GetFor(browser_context);
236 BrowserThread::PostTaskAndReplyWithResult( 236 BrowserThread::PostTaskAndReplyWithResult(
237 BrowserThread::IO, FROM_HERE, 237 BrowserThread::IO, FROM_HERE,
238 base::Bind(&ChromeBlobStorageContext::CreateFileBackedBlob, 238 base::Bind(&ChromeBlobStorageContext::CreateFileBackedBlob,
239 make_scoped_refptr(blob_context), path, offset, size, 239 make_scoped_refptr(blob_context), path, offset, size,
240 expected_modification_time), 240 expected_modification_time),
241 callback); 241 callback);
242 } 242 }
243 243
244 // static 244 // static
245 void BrowserContext::DeliverPushMessage( 245 void BrowserContext::DeliverPushMessage(
246 BrowserContext* browser_context, 246 BrowserContext* browser_context,
247 const GURL& origin, 247 const GURL& origin,
248 int64 service_worker_registration_id, 248 int64 service_worker_registration_id,
249 const std::string& data, 249 const std::string& data,
250 const base::Callback<void(PushDeliveryStatus)>& callback) { 250 const base::Callback<void(PushDeliveryStatus)>& callback) {
251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 251 DCHECK_CURRENTLY_ON(BrowserThread::UI);
252 PushMessagingRouter::DeliverMessage( 252 PushMessagingRouter::DeliverMessage(
253 browser_context, origin, service_worker_registration_id, data, callback); 253 browser_context, origin, service_worker_registration_id, data, callback);
254 } 254 }
255 255
256 // static 256 // static
257 void BrowserContext::NotifyWillBeDestroyed(BrowserContext* browser_context) { 257 void BrowserContext::NotifyWillBeDestroyed(BrowserContext* browser_context) {
258 // Service Workers must shutdown before the browser context is destroyed, 258 // Service Workers must shutdown before the browser context is destroyed,
259 // since they keep render process hosts alive and the codebase assumes that 259 // since they keep render process hosts alive and the codebase assumes that
260 // render process hosts die before their profile (browser context) dies. 260 // render process hosts die before their profile (browser context) dies.
261 ForEachStoragePartition(browser_context, 261 ForEachStoragePartition(browser_context,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 #endif // !OS_IOS 310 #endif // !OS_IOS
311 311
312 BrowserContext::~BrowserContext() { 312 BrowserContext::~BrowserContext() {
313 #if !defined(OS_IOS) 313 #if !defined(OS_IOS)
314 if (GetUserData(kDownloadManagerKeyName)) 314 if (GetUserData(kDownloadManagerKeyName))
315 GetDownloadManager(this)->Shutdown(); 315 GetDownloadManager(this)->Shutdown();
316 #endif 316 #endif
317 } 317 }
318 318
319 } // namespace content 319 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host_impl.cc ('k') | content/browser/browser_ipc_logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698