Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / bookmarks / browser / startup_task_runner_service.cc
blob5b9b74139a6ef4fdb9c40b6ec0011cd7cc5c0445
1 // Copyright (c) 2013 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.
5 #include "components/bookmarks/browser/startup_task_runner_service.h"
7 #include "base/deferred_sequenced_task_runner.h"
8 #include "base/logging.h"
9 #include "base/sequenced_task_runner.h"
11 namespace bookmarks {
13 StartupTaskRunnerService::StartupTaskRunnerService(
14 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner)
15 : io_task_runner_(io_task_runner) {
16 DCHECK(io_task_runner_);
19 StartupTaskRunnerService::~StartupTaskRunnerService() {
22 scoped_refptr<base::DeferredSequencedTaskRunner>
23 StartupTaskRunnerService::GetBookmarkTaskRunner() {
24 DCHECK(CalledOnValidThread());
25 if (!bookmark_task_runner_) {
26 bookmark_task_runner_ =
27 new base::DeferredSequencedTaskRunner(io_task_runner_);
29 return bookmark_task_runner_;
32 void StartupTaskRunnerService::StartDeferredTaskRunners() {
33 GetBookmarkTaskRunner()->Start();
36 } // namespace bookmarks