storage_partition_impl.cc revision bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3
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 3// found in the LICENSE file. 4 5#include "content/browser/storage_partition_impl.h" 6 7#include "base/sequenced_task_runner.h" 8#include "base/strings/utf_string_conversions.h" 9#include "content/browser/browser_main_loop.h" 10#include "content/browser/fileapi/browser_file_system_helper.h" 11#include "content/browser/gpu/shader_disk_cache.h" 12#include "content/public/browser/browser_context.h" 13#include "content/public/browser/browser_thread.h" 14#include "content/public/browser/dom_storage_context.h" 15#include "content/public/browser/indexed_db_context.h" 16#include "net/base/completion_callback.h" 17#include "net/base/net_errors.h" 18#include "net/cookies/cookie_monster.h" 19#include "net/url_request/url_request_context.h" 20#include "net/url_request/url_request_context_getter.h" 21#include "webkit/browser/database/database_tracker.h" 22#include "webkit/browser/quota/quota_manager.h" 23#include "webkit/common/dom_storage/dom_storage_types.h" 24 25namespace content { 26 27namespace { 28 29int GenerateQuotaClientMask(uint32 remove_mask) { 30 int quota_client_mask = 0; 31 32 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_FILE_SYSTEMS) 33 quota_client_mask |= quota::QuotaClient::kFileSystem; 34 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_WEBSQL) 35 quota_client_mask |= quota::QuotaClient::kDatabase; 36 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_APPCACHE) 37 quota_client_mask |= quota::QuotaClient::kAppcache; 38 if (remove_mask & StoragePartition::REMOVE_DATA_MASK_INDEXEDDB) 39 quota_client_mask |= quota::QuotaClient::kIndexedDatabase; 40 41 return quota_client_mask; 42} 43 44void OnClearedCookies(const base::Closure& callback, int num_deleted) { 45 // The final callback needs to happen from UI thread. 46 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 47 BrowserThread::PostTask( 48 BrowserThread::UI, FROM_HERE, 49 base::Bind(&OnClearedCookies, callback, num_deleted)); 50 return; 51 } 52 53 callback.Run(); 54} 55 56void ClearCookiesOnIOThread( 57 const scoped_refptr<net::URLRequestContextGetter>& rq_context, 58 const base::Time begin, 59 const base::Time end, 60 const base::Closure& callback) { 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 62 net::CookieStore* cookie_store = rq_context-> 63 GetURLRequestContext()->cookie_store(); 64 cookie_store->DeleteAllCreatedBetweenAsync(begin, end, 65 base::Bind(&OnClearedCookies, callback)); 66} 67 68void OnQuotaManagedOriginDeleted(const GURL& origin, 69 quota::StorageType type, 70 size_t* origins_to_delete_count, 71 const base::Closure& callback, 72 quota::QuotaStatusCode status) { 73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 74 DCHECK_GT(*origins_to_delete_count, 0u); 75 if (status != quota::kQuotaStatusOk) { 76 DLOG(ERROR) << "Couldn't remove data of type " << type << " for origin " 77 << origin << ". Status: " << status; 78 } 79 80 (*origins_to_delete_count)--; 81 if (*origins_to_delete_count == 0) { 82 delete origins_to_delete_count; 83 callback.Run(); 84 } 85} 86 87void ClearQuotaManagedOriginsOnIOThread(quota::QuotaManager* quota_manager, 88 uint32 remove_mask, 89 const base::Closure& callback, 90 const std::set<GURL>& origins, 91 quota::StorageType quota_storage_type) { 92 // The QuotaManager manages all storage other than cookies, LocalStorage, 93 // and SessionStorage. This loop wipes out most HTML5 storage for the given 94 // origins. 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 96 97 if (!origins.size()) { 98 // No origins to clear. 99 callback.Run(); 100 return; 101 } 102 103 std::set<GURL>::const_iterator origin; 104 size_t* origins_to_delete_count = new size_t(origins.size()); 105 for (std::set<GURL>::const_iterator origin = origins.begin(); 106 origin != origins.end(); ++origin) { 107 quota_manager->DeleteOriginData( 108 *origin, quota_storage_type, 109 GenerateQuotaClientMask(remove_mask), 110 base::Bind(&OnQuotaManagedOriginDeleted, 111 origin->GetOrigin(), quota_storage_type, 112 origins_to_delete_count, callback)); 113 } 114} 115 116void ClearShaderCacheOnIOThread(const base::FilePath& path, 117 const base::Time begin, 118 const base::Time end, 119 const base::Closure& callback) { 120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 121 ShaderCacheFactory::GetInstance()->ClearByPath(path, begin, end, callback); 122} 123 124void OnLocalStorageUsageInfo( 125 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, 126 const base::Time delete_begin, 127 const base::Time delete_end, 128 const base::Closure& callback, 129 const std::vector<dom_storage::LocalStorageUsageInfo>& infos) { 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 131 132 for (size_t i = 0; i < infos.size(); ++i) { 133 if (infos[i].last_modified >= delete_begin && 134 infos[i].last_modified <= delete_end) { 135 dom_storage_context->DeleteLocalStorage(infos[i].origin); 136 } 137 } 138 callback.Run(); 139} 140 141void OnSessionStorageUsageInfo( 142 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, 143 const base::Closure& callback, 144 const std::vector<dom_storage::SessionStorageUsageInfo>& infos) { 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 146 147 for (size_t i = 0; i < infos.size(); ++i) 148 dom_storage_context->DeleteSessionStorage(infos[i]); 149 150 callback.Run(); 151} 152 153void ClearLocalStorageOnUIThread( 154 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, 155 const GURL& remove_origin, 156 const base::Time begin, 157 const base::Time end, 158 const base::Closure& callback) { 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 160 161 if (!remove_origin.is_empty()) { 162 dom_storage_context->DeleteLocalStorage(remove_origin); 163 callback.Run(); 164 return; 165 } 166 167 dom_storage_context->GetLocalStorageUsage( 168 base::Bind(&OnLocalStorageUsageInfo, 169 dom_storage_context, begin, end, callback)); 170} 171 172void ClearSessionStorageOnUIThread( 173 const scoped_refptr<DOMStorageContextImpl>& dom_storage_context, 174 const base::Closure& callback) { 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 176 177 dom_storage_context->GetSessionStorageUsage( 178 base::Bind(&OnSessionStorageUsageInfo, dom_storage_context, callback)); 179} 180 181} // namespace 182 183// Helper for deleting quota managed data from a partition. 184// 185// Most of the operations in this class are done on IO thread. 186struct StoragePartitionImpl::QuotaManagedDataDeletionHelper { 187 QuotaManagedDataDeletionHelper(const base::Closure& callback) 188 : callback(callback), task_count(0) { 189 } 190 191 void IncrementTaskCountOnIO(); 192 void DecrementTaskCountOnIO(); 193 194 void ClearDataOnIOThread( 195 const scoped_refptr<quota::QuotaManager>& quota_manager, 196 const base::Time begin, 197 uint32 remove_mask, 198 uint32 quota_storage_remove_mask, 199 const GURL& remove_origin); 200 201 // Accessed on IO thread. 202 const base::Closure callback; 203 // Accessed on IO thread. 204 int task_count; 205}; 206 207// Helper for deleting all sorts of data from a partition, keeps track of 208// deletion status. 209// 210// StoragePartitionImpl creates an instance of this class to keep track of 211// data deletion progress. Deletion requires deleting multiple bits of data 212// (e.g. cookies, local storage, session storage etc.) and hopping between UI 213// and IO thread. An instance of this class is created in the beginning of 214// deletion process (StoragePartitionImpl::ClearDataImpl) and the instance is 215// forwarded and updated on each (sub) deletion's callback. The instance is 216// finally destroyed when deletion completes (and |callback| is invoked). 217struct StoragePartitionImpl::DataDeletionHelper { 218 DataDeletionHelper(const base::Closure& callback) 219 : callback(callback), task_count(0) { 220 } 221 222 void IncrementTaskCountOnUI(); 223 void DecrementTaskCountOnUI(); 224 225 void ClearDataOnUIThread(uint32 remove_mask, 226 uint32 quota_storage_remove_mask, 227 const GURL& remove_origin, 228 const base::FilePath& path, 229 net::URLRequestContextGetter* rq_context, 230 DOMStorageContextImpl* dom_storage_context, 231 quota::QuotaManager* quota_manager, 232 const base::Time begin, 233 const base::Time end); 234 235 // Accessed on UI thread. 236 const base::Closure callback; 237 // Accessed on UI thread. 238 int task_count; 239}; 240 241void ClearQuotaManagedDataOnIOThread( 242 const scoped_refptr<quota::QuotaManager>& quota_manager, 243 const base::Time begin, 244 uint32 remove_mask, 245 uint32 quota_storage_remove_mask, 246 const GURL& remove_origin, 247 const base::Closure& callback) { 248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 249 250 StoragePartitionImpl::QuotaManagedDataDeletionHelper* helper = 251 new StoragePartitionImpl::QuotaManagedDataDeletionHelper(callback); 252 helper->ClearDataOnIOThread(quota_manager, begin, 253 remove_mask, quota_storage_remove_mask, remove_origin); 254} 255 256StoragePartitionImpl::StoragePartitionImpl( 257 const base::FilePath& partition_path, 258 quota::QuotaManager* quota_manager, 259 ChromeAppCacheService* appcache_service, 260 fileapi::FileSystemContext* filesystem_context, 261 webkit_database::DatabaseTracker* database_tracker, 262 DOMStorageContextImpl* dom_storage_context, 263 IndexedDBContextImpl* indexed_db_context, 264 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store) 265 : partition_path_(partition_path), 266 quota_manager_(quota_manager), 267 appcache_service_(appcache_service), 268 filesystem_context_(filesystem_context), 269 database_tracker_(database_tracker), 270 dom_storage_context_(dom_storage_context), 271 indexed_db_context_(indexed_db_context), 272 webrtc_identity_store_(webrtc_identity_store.Pass()) {} 273 274StoragePartitionImpl::~StoragePartitionImpl() { 275 // These message loop checks are just to avoid leaks in unittests. 276 if (GetDatabaseTracker() && 277 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { 278 BrowserThread::PostTask( 279 BrowserThread::FILE, FROM_HERE, 280 base::Bind(&webkit_database::DatabaseTracker::Shutdown, 281 GetDatabaseTracker())); 282 } 283 284 if (GetDOMStorageContext()) 285 GetDOMStorageContext()->Shutdown(); 286} 287 288// TODO(ajwong): Break the direct dependency on |context|. We only 289// need 3 pieces of info from it. 290StoragePartitionImpl* StoragePartitionImpl::Create( 291 BrowserContext* context, 292 bool in_memory, 293 const base::FilePath& partition_path) { 294 // Ensure that these methods are called on the UI thread, except for 295 // unittests where a UI thread might not have been created. 296 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || 297 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); 298 299 // All of the clients have to be created and registered with the 300 // QuotaManager prior to the QuotaManger being used. We do them 301 // all together here prior to handing out a reference to anything 302 // that utilizes the QuotaManager. 303 scoped_refptr<quota::QuotaManager> quota_manager = new quota::QuotaManager( 304 in_memory, 305 partition_path, 306 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), 307 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), 308 context->GetSpecialStoragePolicy()); 309 310 // Each consumer is responsible for registering its QuotaClient during 311 // its construction. 312 scoped_refptr<fileapi::FileSystemContext> filesystem_context = 313 CreateFileSystemContext(context, 314 partition_path, in_memory, 315 quota_manager->proxy()); 316 317 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = 318 new webkit_database::DatabaseTracker( 319 partition_path, 320 in_memory, 321 context->GetSpecialStoragePolicy(), 322 quota_manager->proxy(), 323 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) 324 .get()); 325 326 base::FilePath path = in_memory ? base::FilePath() : partition_path; 327 scoped_refptr<DOMStorageContextImpl> dom_storage_context = 328 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); 329 330 // BrowserMainLoop may not be initialized in unit tests. Tests will 331 // need to inject their own task runner into the IndexedDBContext. 332 base::SequencedTaskRunner* idb_task_runner = 333 BrowserThread::CurrentlyOn(BrowserThread::UI) && 334 BrowserMainLoop::GetInstance() 335 ? BrowserMainLoop::GetInstance()->indexed_db_thread() 336 ->message_loop_proxy().get() 337 : NULL; 338 scoped_refptr<IndexedDBContextImpl> indexed_db_context = 339 new IndexedDBContextImpl(path, 340 context->GetSpecialStoragePolicy(), 341 quota_manager->proxy(), 342 idb_task_runner); 343 344 scoped_refptr<ChromeAppCacheService> appcache_service = 345 new ChromeAppCacheService(quota_manager->proxy()); 346 347 scoped_ptr<WebRTCIdentityStore> webrtc_identity_store( 348 new WebRTCIdentityStore()); 349 350 return new StoragePartitionImpl(partition_path, 351 quota_manager.get(), 352 appcache_service.get(), 353 filesystem_context.get(), 354 database_tracker.get(), 355 dom_storage_context.get(), 356 indexed_db_context.get(), 357 webrtc_identity_store.Pass()); 358} 359 360base::FilePath StoragePartitionImpl::GetPath() { 361 return partition_path_; 362} 363 364net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { 365 return url_request_context_.get(); 366} 367 368net::URLRequestContextGetter* 369StoragePartitionImpl::GetMediaURLRequestContext() { 370 return media_url_request_context_.get(); 371} 372 373quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() { 374 return quota_manager_.get(); 375} 376 377ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { 378 return appcache_service_.get(); 379} 380 381fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() { 382 return filesystem_context_.get(); 383} 384 385webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() { 386 return database_tracker_.get(); 387} 388 389DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { 390 return dom_storage_context_.get(); 391} 392 393IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { 394 return indexed_db_context_.get(); 395} 396 397void StoragePartitionImpl::ClearDataImpl( 398 uint32 remove_mask, 399 uint32 quota_storage_remove_mask, 400 const GURL& remove_origin, 401 net::URLRequestContextGetter* rq_context, 402 const base::Time begin, 403 const base::Time end, 404 const base::Closure& callback) { 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 406 DataDeletionHelper* helper = new DataDeletionHelper(callback); 407 // |helper| deletes itself when done in 408 // DataDeletionHelper::DecrementTaskCountOnUI(). 409 helper->ClearDataOnUIThread( 410 remove_mask, quota_storage_remove_mask, remove_origin, 411 GetPath(), rq_context, dom_storage_context_, quota_manager_, begin, end); 412} 413 414void StoragePartitionImpl:: 415 QuotaManagedDataDeletionHelper::IncrementTaskCountOnIO() { 416 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 417 ++task_count; 418} 419 420void StoragePartitionImpl:: 421 QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO() { 422 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 423 DCHECK_GT(task_count, 0); 424 --task_count; 425 if (task_count) 426 return; 427 428 callback.Run(); 429 delete this; 430} 431 432void StoragePartitionImpl::QuotaManagedDataDeletionHelper::ClearDataOnIOThread( 433 const scoped_refptr<quota::QuotaManager>& quota_manager, 434 const base::Time begin, 435 uint32 remove_mask, 436 uint32 quota_storage_remove_mask, 437 const GURL& remove_origin) { 438 std::set<GURL> origins; 439 if (!remove_origin.is_empty()) 440 origins.insert(remove_origin); 441 442 IncrementTaskCountOnIO(); 443 base::Closure decrement_callback = base::Bind( 444 &QuotaManagedDataDeletionHelper::DecrementTaskCountOnIO, 445 base::Unretained(this)); 446 447 if (quota_storage_remove_mask & kQuotaManagedPersistentStorage) { 448 IncrementTaskCountOnIO(); 449 if (origins.empty()) { // Remove for all origins. 450 // Ask the QuotaManager for all origins with temporary quota modified 451 // within the user-specified timeframe, and deal with the resulting set in 452 // ClearQuotaManagedOriginsOnIOThread(). 453 quota_manager->GetOriginsModifiedSince( 454 quota::kStorageTypePersistent, begin, 455 base::Bind(&ClearQuotaManagedOriginsOnIOThread, 456 quota_manager, remove_mask, decrement_callback)); 457 } else { 458 ClearQuotaManagedOriginsOnIOThread( 459 quota_manager, remove_mask, decrement_callback, 460 origins, quota::kStorageTypePersistent); 461 } 462 } 463 464 // Do the same for temporary quota. 465 if (quota_storage_remove_mask & kQuotaManagedTemporaryStorage) { 466 IncrementTaskCountOnIO(); 467 if (origins.empty()) { // Remove for all origins. 468 quota_manager->GetOriginsModifiedSince( 469 quota::kStorageTypeTemporary, begin, 470 base::Bind(&ClearQuotaManagedOriginsOnIOThread, 471 quota_manager, remove_mask, decrement_callback)); 472 } else { 473 ClearQuotaManagedOriginsOnIOThread( 474 quota_manager, remove_mask, decrement_callback, 475 origins, quota::kStorageTypeTemporary); 476 } 477 } 478 479 // Do the same for syncable quota. 480 if (quota_storage_remove_mask & kQuotaManagedSyncableStorage) { 481 IncrementTaskCountOnIO(); 482 if (origins.empty()) { // Remove for all origins. 483 quota_manager->GetOriginsModifiedSince( 484 quota::kStorageTypeSyncable, begin, 485 base::Bind(&ClearQuotaManagedOriginsOnIOThread, 486 quota_manager, remove_mask, decrement_callback)); 487 } else { 488 ClearQuotaManagedOriginsOnIOThread( 489 quota_manager, remove_mask, decrement_callback, 490 origins, quota::kStorageTypeSyncable); 491 } 492 } 493 494 DecrementTaskCountOnIO(); 495} 496 497void StoragePartitionImpl::DataDeletionHelper::IncrementTaskCountOnUI() { 498 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 499 ++task_count; 500} 501 502void StoragePartitionImpl::DataDeletionHelper::DecrementTaskCountOnUI() { 503 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 504 BrowserThread::PostTask( 505 BrowserThread::UI, FROM_HERE, 506 base::Bind(&DataDeletionHelper::DecrementTaskCountOnUI, 507 base::Unretained(this))); 508 return; 509 } 510 DCHECK_GT(task_count, 0); 511 --task_count; 512 if (!task_count) { 513 callback.Run(); 514 delete this; 515 } 516} 517 518void StoragePartitionImpl::DataDeletionHelper::ClearDataOnUIThread( 519 uint32 remove_mask, 520 uint32 quota_storage_remove_mask, 521 const GURL& remove_origin, 522 const base::FilePath& path, 523 net::URLRequestContextGetter* rq_context, 524 DOMStorageContextImpl* dom_storage_context, 525 quota::QuotaManager* quota_manager, 526 const base::Time begin, 527 const base::Time end) { 528 DCHECK_NE(remove_mask, 0u); 529 DCHECK(!callback.is_null()); 530 531 IncrementTaskCountOnUI(); 532 base::Closure decrement_callback = base::Bind( 533 &DataDeletionHelper::DecrementTaskCountOnUI, base::Unretained(this)); 534 535 if (remove_mask & REMOVE_DATA_MASK_COOKIES) { 536 // Handle the cookies. 537 IncrementTaskCountOnUI(); 538 BrowserThread::PostTask( 539 BrowserThread::IO, FROM_HERE, 540 base::Bind(&ClearCookiesOnIOThread, 541 make_scoped_refptr(rq_context), begin, end, 542 decrement_callback)); 543 } 544 545 if (remove_mask & REMOVE_DATA_MASK_INDEXEDDB || 546 remove_mask & REMOVE_DATA_MASK_WEBSQL || 547 remove_mask & REMOVE_DATA_MASK_APPCACHE || 548 remove_mask & REMOVE_DATA_MASK_FILE_SYSTEMS) { 549 IncrementTaskCountOnUI(); 550 BrowserThread::PostTask( 551 BrowserThread::IO, FROM_HERE, 552 base::Bind(&ClearQuotaManagedDataOnIOThread, 553 make_scoped_refptr(quota_manager), begin, 554 remove_mask, quota_storage_remove_mask, remove_origin, 555 decrement_callback)); 556 } 557 558 if (remove_mask & REMOVE_DATA_MASK_LOCAL_STORAGE) { 559 IncrementTaskCountOnUI(); 560 ClearLocalStorageOnUIThread( 561 make_scoped_refptr(dom_storage_context), 562 remove_origin, begin, end, decrement_callback); 563 564 // ClearDataImpl cannot clear session storage data when a particular origin 565 // is specified. Therefore we ignore clearing session storage in this case. 566 // TODO(lazyboy): Fix. 567 if (remove_origin.is_empty()) { 568 IncrementTaskCountOnUI(); 569 ClearSessionStorageOnUIThread( 570 make_scoped_refptr(dom_storage_context), decrement_callback); 571 } 572 } 573 574 if (remove_mask & REMOVE_DATA_MASK_SHADER_CACHE) { 575 IncrementTaskCountOnUI(); 576 BrowserThread::PostTask( 577 BrowserThread::IO, FROM_HERE, 578 base::Bind(&ClearShaderCacheOnIOThread, 579 path, begin, end, decrement_callback)); 580 } 581 582 DecrementTaskCountOnUI(); 583} 584 585 586void StoragePartitionImpl::ClearDataForOrigin( 587 uint32 remove_mask, 588 uint32 quota_storage_remove_mask, 589 const GURL& storage_origin, 590 net::URLRequestContextGetter* request_context_getter) { 591 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 592 ClearDataImpl(remove_mask, quota_storage_remove_mask, storage_origin, 593 request_context_getter, base::Time(), base::Time::Max(), 594 base::Bind(&base::DoNothing)); 595} 596 597void StoragePartitionImpl::ClearDataForUnboundedRange( 598 uint32 remove_mask, 599 uint32 quota_storage_remove_mask) { 600 ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), 601 GetURLRequestContext(), base::Time(), base::Time::Max(), 602 base::Bind(&base::DoNothing)); 603} 604 605void StoragePartitionImpl::ClearDataForRange(uint32 remove_mask, 606 uint32 quota_storage_remove_mask, 607 const base::Time& begin, 608 const base::Time& end, 609 const base::Closure& callback) { 610 ClearDataImpl(remove_mask, quota_storage_remove_mask, GURL(), 611 GetURLRequestContext(), begin, end, callback); 612} 613 614WebRTCIdentityStore* StoragePartitionImpl::GetWebRTCIdentityStore() { 615 return webrtc_identity_store_.get(); 616} 617 618void StoragePartitionImpl::SetURLRequestContext( 619 net::URLRequestContextGetter* url_request_context) { 620 url_request_context_ = url_request_context; 621} 622 623void StoragePartitionImpl::SetMediaURLRequestContext( 624 net::URLRequestContextGetter* media_url_request_context) { 625 media_url_request_context_ = media_url_request_context; 626} 627 628} // namespace content 629