#ifndef MOJO_SHELL_TASK_RUNNERS_H_
#define MOJO_SHELL_TASK_RUNNERS_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/threading/thread.h"
namespace base {
class SequencedWorkerPool;
}
namespace mojo {
namespace shell {
class TaskRunners {
public:
explicit TaskRunners(base::SingleThreadTaskRunner* ui_runner);
~TaskRunners();
base::SingleThreadTaskRunner* ui_runner() const {
return ui_runner_.get();
}
base::SingleThreadTaskRunner* io_runner() const {
return io_thread_->message_loop_proxy();
}
base::SingleThreadTaskRunner* file_runner() const {
return file_thread_->message_loop_proxy();
}
base::MessageLoopProxy* cache_runner() const {
return cache_thread_->message_loop_proxy();
}
base::SequencedWorkerPool* blocking_pool() const {
return blocking_pool_.get();
}
private:
scoped_refptr<base::SingleThreadTaskRunner> ui_runner_;
scoped_ptr<base::Thread> cache_thread_;
scoped_ptr<base::Thread> io_thread_;
scoped_ptr<base::Thread> file_thread_;
scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
DISALLOW_COPY_AND_ASSIGN(TaskRunners);
};
}
}
#endif