Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/task_scheduler/post_task.h" | |
| 18 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 19 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 19 #include "content/browser/browser_main_loop.h" | 20 #include "content/browser/browser_main_loop.h" |
| 20 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h" | 21 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h" |
| 21 #include "content/browser/fileapi/browser_file_system_helper.h" | 22 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 22 #include "content/browser/gpu/shader_cache_factory.h" | 23 #include "content/browser/gpu/shader_cache_factory.h" |
| 23 #include "content/browser/notifications/platform_notification_context_impl.h" | 24 #include "content/browser/notifications/platform_notification_context_impl.h" |
| 24 #include "content/common/dom_storage/dom_storage_types.h" | 25 #include "content/common/dom_storage/dom_storage_types.h" |
| 25 #include "content/public/browser/browser_context.h" | 26 #include "content/public/browser/browser_context.h" |
| 26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/content_browser_client.h" | 28 #include "content/public/browser/content_browser_client.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 partition->database_tracker_ = new storage::DatabaseTracker( | 465 partition->database_tracker_ = new storage::DatabaseTracker( |
| 465 partition_path, in_memory, context->GetSpecialStoragePolicy(), | 466 partition_path, in_memory, context->GetSpecialStoragePolicy(), |
| 466 quota_manager_proxy.get(), | 467 quota_manager_proxy.get(), |
| 467 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); | 468 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); |
| 468 | 469 |
| 469 partition->dom_storage_context_ = new DOMStorageContextWrapper( | 470 partition->dom_storage_context_ = new DOMStorageContextWrapper( |
| 470 BrowserContext::GetConnectorFor(context), | 471 BrowserContext::GetConnectorFor(context), |
| 471 in_memory ? base::FilePath() : context->GetPath(), | 472 in_memory ? base::FilePath() : context->GetPath(), |
| 472 relative_partition_path, context->GetSpecialStoragePolicy()); | 473 relative_partition_path, context->GetSpecialStoragePolicy()); |
| 473 | 474 |
| 475 // TODO(jsbell): Create task runner within IndexedDBContextImpl. | |
| 474 // BrowserMainLoop may not be initialized in unit tests. Tests will | 476 // BrowserMainLoop may not be initialized in unit tests. Tests will |
| 475 // need to inject their own task runner into the IndexedDBContext. | 477 // need to inject their own task runner into the IndexedDBContext. |
|
gab
2017/06/12 15:13:07
This is no longer true, so long as tests have a ba
jsbell
2017/06/12 16:19:02
Yes...
| |
| 476 base::SequencedTaskRunner* idb_task_runner = | 478 scoped_refptr<base::SequencedTaskRunner> idb_task_runner = |
| 477 BrowserThread::CurrentlyOn(BrowserThread::UI) && | 479 BrowserThread::CurrentlyOn(BrowserThread::UI) && |
| 478 BrowserMainLoop::GetInstance() | 480 BrowserMainLoop::GetInstance() |
| 479 ? BrowserMainLoop::GetInstance() | 481 ? base::CreateSequencedTaskRunnerWithTraits({ |
| 480 ->indexed_db_thread() | 482 base::MayBlock(), base::WithBaseSyncPrimitives(), |
| 481 ->task_runner() | 483 base::TaskPriority::BACKGROUND, |
|
dmurph
2017/06/09 19:15:07
CAn you run the idb perf tests to see what the imp
jsbell
2017/06/09 20:50:30
Thanks for the reminder! Done.
Summary: no signif
gab
2017/06/12 15:13:08
What is the IDB thread responsible for? Is none of
jsbell
2017/06/12 16:19:02
It runs asynchronous database requests on behalf o
gab
2017/06/12 16:49:11
If it *can* be user visible then it should use Tas
jsbell
2017/06/12 17:45:31
Okay - went with USER_VISIBLE
(The IndexedDB API
gab
2017/06/12 17:59:05
Right, remember that post-mortem, USER_VISIBLE sur
| |
| 482 .get() | 484 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, |
|
gab
2017/06/12 15:13:08
Would it be safe to CONTINUE_ON_SHUTDOWN? Or do we
jsbell
2017/06/12 16:19:02
Looking at the docs... CONTINUE has some scary cav
gab
2017/06/12 16:49:11
"from under you" is referring to things that are r
jsbell
2017/06/12 17:45:31
Okay - being "conservative" and going with SKIP; l
gab
2017/06/12 17:59:05
Perfect, that way we can avoid this bigger change
| |
| 483 : NULL; | 485 }) |
| 486 : nullptr; | |
| 484 | 487 |
| 485 base::FilePath path = in_memory ? base::FilePath() : partition_path; | 488 base::FilePath path = in_memory ? base::FilePath() : partition_path; |
| 486 partition->indexed_db_context_ = | 489 partition->indexed_db_context_ = |
| 487 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), | 490 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), |
| 488 quota_manager_proxy.get(), idb_task_runner); | 491 quota_manager_proxy.get(), idb_task_runner); |
| 489 | 492 |
| 490 partition->cache_storage_context_ = new CacheStorageContextImpl(context); | 493 partition->cache_storage_context_ = new CacheStorageContextImpl(context); |
| 491 partition->cache_storage_context_->Init(path, quota_manager_proxy); | 494 partition->cache_storage_context_->Init(path, quota_manager_proxy); |
| 492 | 495 |
| 493 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context); | 496 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context); |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 media_url_request_context_ = media_url_request_context; | 984 media_url_request_context_ = media_url_request_context; |
| 982 } | 985 } |
| 983 | 986 |
| 984 void StoragePartitionImpl::GetQuotaSettings( | 987 void StoragePartitionImpl::GetQuotaSettings( |
| 985 const storage::OptionalQuotaSettingsCallback& callback) { | 988 const storage::OptionalQuotaSettingsCallback& callback) { |
| 986 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, | 989 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, |
| 987 callback); | 990 callback); |
| 988 } | 991 } |
| 989 | 992 |
| 990 } // namespace content | 993 } // namespace content |
| OLD | NEW |