Flush after LTHI::ReclaimResources when hidden.
[chromium-blink-merge.git] / mojo / shell / task_runners.h
blob17cdf89bf51ef41c3223af263d30dd75b627dd37
1 // Copyright 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 MOJO_SHELL_TASK_RUNNERS_H_
6 #define MOJO_SHELL_TASK_RUNNERS_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/threading/thread.h"
14 namespace base {
15 class SequencedWorkerPool;
18 namespace mojo {
19 namespace shell {
21 // A context object that contains the common task runners for the shell's main
22 // process.
23 class TaskRunners {
24 public:
25 explicit TaskRunners(base::SingleThreadTaskRunner* ui_runner);
26 ~TaskRunners();
28 base::SingleThreadTaskRunner* ui_runner() const {
29 return ui_runner_.get();
32 base::SingleThreadTaskRunner* io_runner() const {
33 return io_thread_->message_loop_proxy();
36 base::SingleThreadTaskRunner* file_runner() const {
37 return file_thread_->message_loop_proxy();
40 base::MessageLoopProxy* cache_runner() const {
41 return cache_thread_->message_loop_proxy();
44 base::SequencedWorkerPool* blocking_pool() const {
45 return blocking_pool_.get();
48 private:
49 // TODO(beng): should this be named shell_runner_?
50 scoped_refptr<base::SingleThreadTaskRunner> ui_runner_;
51 scoped_ptr<base::Thread> cache_thread_;
52 scoped_ptr<base::Thread> io_thread_;
53 scoped_ptr<base::Thread> file_thread_;
55 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
57 DISALLOW_COPY_AND_ASSIGN(TaskRunners);
60 } // namespace shell
61 } // namespace mojo
63 #endif // MOJO_SHELL_TASK_RUNNERS_H_