Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / bookmarks / browser / startup_task_runner_service.h
blobb39819af135d2a10201a9dd547fb5727df06d0c4
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 #ifndef COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "components/keyed_service/core/keyed_service.h"
13 namespace base {
14 class DeferredSequencedTaskRunner;
15 class SequencedTaskRunner;
16 } // namespace base
18 namespace bookmarks {
20 // This service manages the startup task runners.
21 class StartupTaskRunnerService : public base::NonThreadSafe,
22 public KeyedService {
23 public:
24 explicit StartupTaskRunnerService(
25 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner);
26 ~StartupTaskRunnerService() override;
28 // Returns sequenced task runner where all bookmarks I/O operations are
29 // performed.
30 // This method should only be called from the UI thread.
31 // Note: Using a separate task runner per profile service gives a better
32 // management of the sequence in which the task are started in order to avoid
33 // congestion during start-up (e.g the caller may decide to start loading the
34 // bookmarks only after the history finished).
35 scoped_refptr<base::DeferredSequencedTaskRunner> GetBookmarkTaskRunner();
37 // Starts the task runners that are deferred during start-up.
38 void StartDeferredTaskRunners();
40 private:
41 scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
42 scoped_refptr<base::DeferredSequencedTaskRunner> bookmark_task_runner_;
44 DISALLOW_COPY_AND_ASSIGN(StartupTaskRunnerService);
47 } // namespace bookmarks
49 #endif // COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_