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

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

Issue 2930183002: Let IndexedDBContextImpl create its own task runner (Closed)
Patch Set: rebased Created 3 years, 5 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/browser/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/sequenced_task_runner.h" 16 #include "base/sequenced_task_runner.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/task_scheduler/post_task.h"
20 #include "content/browser/blob_storage/blob_registry_wrapper.h" 19 #include "content/browser/blob_storage/blob_registry_wrapper.h"
21 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 20 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
22 #include "content/browser/browser_main_loop.h" 21 #include "content/browser/browser_main_loop.h"
23 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h" 22 #include "content/browser/browsing_data/storage_partition_http_cache_data_remove r.h"
24 #include "content/browser/fileapi/browser_file_system_helper.h" 23 #include "content/browser/fileapi/browser_file_system_helper.h"
25 #include "content/browser/gpu/shader_cache_factory.h" 24 #include "content/browser/gpu/shader_cache_factory.h"
26 #include "content/browser/notifications/platform_notification_context_impl.h" 25 #include "content/browser/notifications/platform_notification_context_impl.h"
27 #include "content/common/dom_storage/dom_storage_types.h" 26 #include "content/common/dom_storage/dom_storage_types.h"
28 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
29 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 partition->database_tracker_ = new storage::DatabaseTracker( 465 partition->database_tracker_ = new storage::DatabaseTracker(
467 partition_path, in_memory, context->GetSpecialStoragePolicy(), 466 partition_path, in_memory, context->GetSpecialStoragePolicy(),
468 quota_manager_proxy.get(), 467 quota_manager_proxy.get(),
469 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get()); 468 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get());
470 469
471 partition->dom_storage_context_ = new DOMStorageContextWrapper( 470 partition->dom_storage_context_ = new DOMStorageContextWrapper(
472 BrowserContext::GetConnectorFor(context), 471 BrowserContext::GetConnectorFor(context),
473 in_memory ? base::FilePath() : context->GetPath(), 472 in_memory ? base::FilePath() : context->GetPath(),
474 relative_partition_path, context->GetSpecialStoragePolicy()); 473 relative_partition_path, context->GetSpecialStoragePolicy());
475 474
476 // BrowserMainLoop may not be initialized in unit tests. Tests will
477 // need to inject their own task runner into the IndexedDBContext.
478 // TODO(jsbell): This is no longer true, update tests to provide use a
479 // base::test::ScopedTaskEnvironment instead of injecting a test task
480 // runner.
481 scoped_refptr<base::SequencedTaskRunner> idb_task_runner =
482 BrowserThread::CurrentlyOn(BrowserThread::UI) &&
483 BrowserMainLoop::GetInstance()
484 ? base::CreateSequencedTaskRunnerWithTraits({
485 base::MayBlock(), base::WithBaseSyncPrimitives(),
486 base::TaskPriority::USER_VISIBLE,
487 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN,
488 })
489 : nullptr;
490
491 base::FilePath path = in_memory ? base::FilePath() : partition_path; 475 base::FilePath path = in_memory ? base::FilePath() : partition_path;
492 partition->indexed_db_context_ = 476 partition->indexed_db_context_ = new IndexedDBContextImpl(
493 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), 477 path, context->GetSpecialStoragePolicy(), quota_manager_proxy);
494 quota_manager_proxy.get(), idb_task_runner);
495 478
496 partition->cache_storage_context_ = new CacheStorageContextImpl(context); 479 partition->cache_storage_context_ = new CacheStorageContextImpl(context);
497 partition->cache_storage_context_->Init(path, quota_manager_proxy); 480 partition->cache_storage_context_->Init(path, quota_manager_proxy);
498 481
499 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context); 482 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context);
500 partition->service_worker_context_->set_storage_partition(partition.get()); 483 partition->service_worker_context_->set_storage_partition(partition.get());
501 484
502 partition->appcache_service_ = 485 partition->appcache_service_ =
503 new ChromeAppCacheService(quota_manager_proxy.get()); 486 new ChromeAppCacheService(quota_manager_proxy.get());
504 487
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 media_url_request_context_ = media_url_request_context; 985 media_url_request_context_ = media_url_request_context;
1003 } 986 }
1004 987
1005 void StoragePartitionImpl::GetQuotaSettings( 988 void StoragePartitionImpl::GetQuotaSettings(
1006 storage::OptionalQuotaSettingsCallback callback) { 989 storage::OptionalQuotaSettingsCallback callback) {
1007 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, 990 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this,
1008 std::move(callback)); 991 std::move(callback));
1009 } 992 }
1010 993
1011 } // namespace content 994 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_unittest.cc ('k') | content/public/browser/indexed_db_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698