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

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

Issue 1504033007: Move Indexed DB from dedicated thread to task scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timer
Patch Set: Tweak traits Created 3 years, 6 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
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
474 // BrowserMainLoop may not be initialized in unit tests. Tests will 475 // BrowserMainLoop may not be initialized in unit tests. Tests will
475 // need to inject their own task runner into the IndexedDBContext. 476 // need to inject their own task runner into the IndexedDBContext.
476 base::SequencedTaskRunner* idb_task_runner = 477 // TODO(jsbell): This is no longer true, update tests to provide use a
478 // base::test::ScopedTaskEnvironment instead of injecting a test task
479 // runner.
480 scoped_refptr<base::SequencedTaskRunner> idb_task_runner =
477 BrowserThread::CurrentlyOn(BrowserThread::UI) && 481 BrowserThread::CurrentlyOn(BrowserThread::UI) &&
478 BrowserMainLoop::GetInstance() 482 BrowserMainLoop::GetInstance()
479 ? BrowserMainLoop::GetInstance() 483 ? base::CreateSequencedTaskRunnerWithTraits({
480 ->indexed_db_thread() 484 base::MayBlock(), base::WithBaseSyncPrimitives(),
481 ->task_runner() 485 base::TaskPriority::USER_VISIBLE,
482 .get() 486 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN,
483 : NULL; 487 })
488 : nullptr;
484 489
485 base::FilePath path = in_memory ? base::FilePath() : partition_path; 490 base::FilePath path = in_memory ? base::FilePath() : partition_path;
486 partition->indexed_db_context_ = 491 partition->indexed_db_context_ =
487 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), 492 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(),
488 quota_manager_proxy.get(), idb_task_runner); 493 quota_manager_proxy.get(), idb_task_runner);
489 494
490 partition->cache_storage_context_ = new CacheStorageContextImpl(context); 495 partition->cache_storage_context_ = new CacheStorageContextImpl(context);
491 partition->cache_storage_context_->Init(path, quota_manager_proxy); 496 partition->cache_storage_context_->Init(path, quota_manager_proxy);
492 497
493 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context); 498 partition->service_worker_context_ = new ServiceWorkerContextWrapper(context);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 media_url_request_context_ = media_url_request_context; 986 media_url_request_context_ = media_url_request_context;
982 } 987 }
983 988
984 void StoragePartitionImpl::GetQuotaSettings( 989 void StoragePartitionImpl::GetQuotaSettings(
985 const storage::OptionalQuotaSettingsCallback& callback) { 990 const storage::OptionalQuotaSettingsCallback& callback) {
986 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, 991 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this,
987 callback); 992 callback);
988 } 993 }
989 994
990 } // namespace content 995 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698