mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Rename CEF1 files from /trunk to /trunk/cef1 (issue #564).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@570 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
48
cef1/libcef/task_impl.cc
Normal file
48
cef1/libcef/task_impl.cc
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2011 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.
|
||||
|
||||
#include "include/cef_task.h"
|
||||
#include "libcef/cef_thread.h"
|
||||
#include "base/bind.h"
|
||||
|
||||
namespace {
|
||||
|
||||
int GetThreadId(CefThreadId threadId) {
|
||||
switch (threadId) {
|
||||
case TID_UI: return CefThread::UI;
|
||||
case TID_IO: return CefThread::IO;
|
||||
case TID_FILE: return CefThread::FILE;
|
||||
};
|
||||
NOTREACHED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool CefCurrentlyOn(CefThreadId threadId) {
|
||||
int id = GetThreadId(threadId);
|
||||
if (id < 0)
|
||||
return false;
|
||||
|
||||
return CefThread::CurrentlyOn(static_cast<CefThread::ID>(id));
|
||||
}
|
||||
|
||||
bool CefPostTask(CefThreadId threadId, CefRefPtr<CefTask> task) {
|
||||
int id = GetThreadId(threadId);
|
||||
if (id < 0)
|
||||
return false;
|
||||
|
||||
return CefThread::PostTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task, threadId));
|
||||
}
|
||||
|
||||
bool CefPostDelayedTask(CefThreadId threadId, CefRefPtr<CefTask> task,
|
||||
int64 delay_ms) {
|
||||
int id = GetThreadId(threadId);
|
||||
if (id < 0)
|
||||
return false;
|
||||
|
||||
return CefThread::PostDelayedTask(static_cast<CefThread::ID>(id), FROM_HERE,
|
||||
base::Bind(&CefTask::Execute, task, threadId), delay_ms);
|
||||
}
|
Reference in New Issue
Block a user