2014-07-15 00:18:51 +02:00
|
|
|
// Copyright (c) 2014 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
|
|
|
#include "include/wrapper/cef_closure_task.h"
|
2017-05-19 11:06:00 +02:00
|
|
|
#include "include/base/cef_callback.h"
|
2014-07-15 00:18:51 +02:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
class CefClosureTask : public CefTask {
|
|
|
|
public:
|
2017-05-17 11:29:28 +02:00
|
|
|
explicit CefClosureTask(const base::Closure& closure) : closure_(closure) {}
|
2014-07-15 00:18:51 +02:00
|
|
|
|
|
|
|
// CefTask method
|
|
|
|
virtual void Execute() OVERRIDE {
|
|
|
|
closure_.Run();
|
|
|
|
closure_.Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
base::Closure closure_;
|
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefClosureTask);
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefClosureTask);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2014-07-15 20:10:40 +02:00
|
|
|
CefRefPtr<CefTask> CefCreateClosureTask(const base::Closure& closure) {
|
2014-07-15 00:18:51 +02:00
|
|
|
return new CefClosureTask(closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CefPostTask(CefThreadId threadId, const base::Closure& closure) {
|
|
|
|
return CefPostTask(threadId, new CefClosureTask(closure));
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
bool CefPostDelayedTask(CefThreadId threadId,
|
|
|
|
const base::Closure& closure,
|
2014-07-15 00:18:51 +02:00
|
|
|
int64 delay_ms) {
|
|
|
|
return CefPostDelayedTask(threadId, new CefClosureTask(closure), delay_ms);
|
|
|
|
}
|