2013-01-03 18:24:24 +01:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
#ifndef CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|
2013-01-03 18:24:24 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "include/cef_task.h"
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2017-09-21 13:57:40 +02:00
|
|
|
#include "base/single_thread_task_runner.h"
|
2013-01-03 18:24:24 +01:00
|
|
|
|
|
|
|
class CefTaskRunnerImpl : public CefTaskRunner {
|
|
|
|
public:
|
|
|
|
explicit CefTaskRunnerImpl(
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
|
2013-01-03 18:24:24 +01:00
|
|
|
|
|
|
|
// Returns the task runner associated with |threadId|.
|
2017-09-21 13:57:40 +02:00
|
|
|
static scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
|
2017-05-17 11:29:28 +02:00
|
|
|
CefThreadId threadId);
|
2013-01-03 18:24:24 +01:00
|
|
|
// Returns the current task runner.
|
2017-09-21 13:57:40 +02:00
|
|
|
static scoped_refptr<base::SingleThreadTaskRunner> GetCurrentTaskRunner();
|
2013-01-03 18:24:24 +01:00
|
|
|
|
|
|
|
// CefTaskRunner methods:
|
2014-11-12 20:25:15 +01:00
|
|
|
bool IsSame(CefRefPtr<CefTaskRunner> that) override;
|
|
|
|
bool BelongsToCurrentThread() override;
|
|
|
|
bool BelongsToThread(CefThreadId threadId) override;
|
|
|
|
bool PostTask(CefRefPtr<CefTask> task) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool PostDelayedTask(CefRefPtr<CefTask> task, int64 delay_ms) override;
|
2013-01-03 18:24:24 +01:00
|
|
|
|
|
|
|
private:
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
2013-01-03 18:24:24 +01:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefTaskRunnerImpl);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefTaskRunnerImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_TASK_RUNNER_IMPL_H_
|