OLD | NEW |
---|---|
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/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 if (GetPlatformNotificationContext()) | 401 if (GetPlatformNotificationContext()) |
402 GetPlatformNotificationContext()->Shutdown(); | 402 GetPlatformNotificationContext()->Shutdown(); |
403 | 403 |
404 if (GetBackgroundSyncContext()) | 404 if (GetBackgroundSyncContext()) |
405 GetBackgroundSyncContext()->Shutdown(); | 405 GetBackgroundSyncContext()->Shutdown(); |
406 } | 406 } |
407 | 407 |
408 StoragePartitionImpl* StoragePartitionImpl::Create( | 408 StoragePartitionImpl* StoragePartitionImpl::Create( |
409 BrowserContext* context, | 409 BrowserContext* context, |
410 bool in_memory, | 410 bool in_memory, |
411 const base::FilePath& partition_path) { | 411 const base::FilePath& relative_partition_path) { |
412 // Ensure that these methods are called on the UI thread, except for | 412 // Ensure that these methods are called on the UI thread, except for |
413 // unittests where a UI thread might not have been created. | 413 // unittests where a UI thread might not have been created. |
414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
415 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 415 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
416 | 416 |
417 base::FilePath partition_path = | |
418 context->GetPath().Append(relative_partition_path); | |
419 | |
417 // All of the clients have to be created and registered with the | 420 // All of the clients have to be created and registered with the |
418 // QuotaManager prior to the QuotaManger being used. We do them | 421 // QuotaManager prior to the QuotaManger being used. We do them |
419 // all together here prior to handing out a reference to anything | 422 // all together here prior to handing out a reference to anything |
420 // that utilizes the QuotaManager. | 423 // that utilizes the QuotaManager. |
421 scoped_refptr<storage::QuotaManager> quota_manager = | 424 scoped_refptr<storage::QuotaManager> quota_manager = |
422 new storage::QuotaManager( | 425 new storage::QuotaManager( |
423 in_memory, | 426 in_memory, |
424 partition_path, | 427 partition_path, |
425 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), | 428 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
426 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), | 429 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), |
427 context->GetSpecialStoragePolicy()); | 430 context->GetSpecialStoragePolicy()); |
428 | 431 |
429 // Each consumer is responsible for registering its QuotaClient during | 432 // Each consumer is responsible for registering its QuotaClient during |
430 // its construction. | 433 // its construction. |
431 scoped_refptr<storage::FileSystemContext> filesystem_context = | 434 scoped_refptr<storage::FileSystemContext> filesystem_context = |
432 CreateFileSystemContext( | 435 CreateFileSystemContext( |
433 context, partition_path, in_memory, quota_manager->proxy()); | 436 context, partition_path, in_memory, quota_manager->proxy()); |
434 | 437 |
435 scoped_refptr<storage::DatabaseTracker> database_tracker = | 438 scoped_refptr<storage::DatabaseTracker> database_tracker = |
436 new storage::DatabaseTracker(partition_path, | 439 new storage::DatabaseTracker(partition_path, |
437 in_memory, | 440 in_memory, |
438 context->GetSpecialStoragePolicy(), | 441 context->GetSpecialStoragePolicy(), |
439 quota_manager->proxy(), | 442 quota_manager->proxy(), |
440 BrowserThread::GetMessageLoopProxyForThread( | 443 BrowserThread::GetMessageLoopProxyForThread( |
441 BrowserThread::FILE).get()); | 444 BrowserThread::FILE).get()); |
442 | 445 |
443 base::FilePath path = in_memory ? base::FilePath() : partition_path; | 446 base::FilePath path = in_memory ? base::FilePath() : context->GetPath(); |
horo
2016/03/31 04:23:19
|path| is also used by IndexedDBContextImpl, Cache
| |
444 scoped_refptr<DOMStorageContextWrapper> dom_storage_context = | 447 scoped_refptr<DOMStorageContextWrapper> dom_storage_context = |
445 new DOMStorageContextWrapper(path, context->GetSpecialStoragePolicy()); | 448 new DOMStorageContextWrapper(BrowserContext::GetMojoUserIdFor(context), |
449 path, relative_partition_path, | |
450 context->GetSpecialStoragePolicy()); | |
446 | 451 |
447 // BrowserMainLoop may not be initialized in unit tests. Tests will | 452 // BrowserMainLoop may not be initialized in unit tests. Tests will |
448 // need to inject their own task runner into the IndexedDBContext. | 453 // need to inject their own task runner into the IndexedDBContext. |
449 base::SequencedTaskRunner* idb_task_runner = | 454 base::SequencedTaskRunner* idb_task_runner = |
450 BrowserThread::CurrentlyOn(BrowserThread::UI) && | 455 BrowserThread::CurrentlyOn(BrowserThread::UI) && |
451 BrowserMainLoop::GetInstance() | 456 BrowserMainLoop::GetInstance() |
452 ? BrowserMainLoop::GetInstance() | 457 ? BrowserMainLoop::GetInstance() |
453 ->indexed_db_thread() | 458 ->indexed_db_thread() |
454 ->task_runner() | 459 ->task_runner() |
455 .get() | 460 .get() |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
916 net::URLRequestContextGetter* url_request_context) { | 921 net::URLRequestContextGetter* url_request_context) { |
917 url_request_context_ = url_request_context; | 922 url_request_context_ = url_request_context; |
918 } | 923 } |
919 | 924 |
920 void StoragePartitionImpl::SetMediaURLRequestContext( | 925 void StoragePartitionImpl::SetMediaURLRequestContext( |
921 net::URLRequestContextGetter* media_url_request_context) { | 926 net::URLRequestContextGetter* media_url_request_context) { |
922 media_url_request_context_ = media_url_request_context; | 927 media_url_request_context_ = media_url_request_context; |
923 } | 928 } |
924 | 929 |
925 } // namespace content | 930 } // namespace content |
OLD | NEW |