- CefPostTask(TID_UI, new CEFTaskAdapter(std::move(func)));
+ if (delay_ms <= 0) {
+ CefPostTask(TID_UI, new CEFTaskAdapter(std::move(func)));
+ } else {
+ CefPostDelayedTask(TID_UI, new CEFTaskAdapter(std::move(func)), delay_ms);
+ }
// (CEF only sends OnPaint when there are actual changes,
// so we need to do this explicitly, or we could be stuck on an
// old frame forever if the image doesn't change.)
// (CEF only sends OnPaint when there are actual changes,
// so we need to do this explicitly, or we could be stuck on an
// old frame forever if the image doesn't change.)
post_to_cef_ui_thread([this] {
lock_guard<recursive_mutex> lock(browser_mutex);
if (browser != nullptr) { // Could happen if we are shutting down.
browser->GetHost()->Invalidate(PET_VIEW);
}
post_to_cef_ui_thread([this] {
lock_guard<recursive_mutex> lock(browser_mutex);
if (browser != nullptr) { // Could happen if we are shutting down.
browser->GetHost()->Invalidate(PET_VIEW);
}