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

Side by Side Diff: components/bookmarks/browser/startup_task_runner_service.h

Issue 1165913004: Componentize StartupTaskRunnerService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_PROFILES_STARTUP_TASK_RUNNER_SERVICE_H_ 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_
6 #define CHROME_BROWSER_PROFILES_STARTUP_TASK_RUNNER_SERVICE_H_ 6 #define COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
11 #include "components/keyed_service/core/keyed_service.h" 12 #include "components/keyed_service/core/keyed_service.h"
12 13
13 class Profile;
14
15 namespace base { 14 namespace base {
16 class DeferredSequencedTaskRunner; 15 class DeferredSequencedTaskRunner;
16 class SequencedTaskRunner;
17 } // namespace base 17 } // namespace base
18 18
19 // This service manages the startup task runners. 19 // This service manages the startup task runners.
20 class StartupTaskRunnerService : public base::NonThreadSafe, 20 class StartupTaskRunnerService : public base::NonThreadSafe,
tfarina 2015/06/10 23:18:26 Scott, should we put this in bookmarks namespace?
sky 2015/06/10 23:37:01 Sure.
21 public KeyedService { 21 public KeyedService {
22 public: 22 public:
23 explicit StartupTaskRunnerService(Profile* profile); 23 explicit StartupTaskRunnerService(
24 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner);
24 ~StartupTaskRunnerService() override; 25 ~StartupTaskRunnerService() override;
25 26
26 // Returns sequenced task runner where all bookmarks I/O operations are 27 // Returns sequenced task runner where all bookmarks I/O operations are
27 // performed. 28 // performed.
28 // This method should only be called from the UI thread. 29 // This method should only be called from the UI thread.
29 // Note: Using a separate task runner per profile service gives a better 30 // Note: Using a separate task runner per profile service gives a better
30 // management of the sequence in which the task are started in order to avoid 31 // management of the sequence in which the task are started in order to avoid
31 // congestion during start-up (e.g the caller may decide to start loading the 32 // congestion during start-up (e.g the caller may decide to start loading the
32 // bookmarks only after the history finished). 33 // bookmarks only after the history finished).
33 scoped_refptr<base::DeferredSequencedTaskRunner> GetBookmarkTaskRunner(); 34 scoped_refptr<base::DeferredSequencedTaskRunner> GetBookmarkTaskRunner();
34 35
35 // Starts the task runners that are deferred during start-up. 36 // Starts the task runners that are deferred during start-up.
36 void StartDeferredTaskRunners(); 37 void StartDeferredTaskRunners();
37 38
38 private: 39 private:
39 Profile* profile_; 40 scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
40 scoped_refptr<base::DeferredSequencedTaskRunner> bookmark_task_runner_; 41 scoped_refptr<base::DeferredSequencedTaskRunner> bookmark_task_runner_;
41 42
42 DISALLOW_COPY_AND_ASSIGN(StartupTaskRunnerService); 43 DISALLOW_COPY_AND_ASSIGN(StartupTaskRunnerService);
43 }; 44 };
44 45
45 #endif // CHROME_BROWSER_PROFILES_STARTUP_TASK_RUNNER_SERVICE_H_ 46 #endif // COMPONENTS_BOOKMARKS_BROWSER_STARTUP_TASK_RUNNER_SERVICE_H_
OLDNEW
« no previous file with comments | « components/bookmarks/browser/BUILD.gn ('k') | components/bookmarks/browser/startup_task_runner_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698