void set_max_fps(int max_fps);
void execute_javascript_async(const std::string &js);
void resize(unsigned width, unsigned height);
+ void request_new_frame();
// Callbacks from NageruCEFClient.
void OnPaint(const void *buffer, int width, int height);
uint32_t get_current_audio_input() const override { return 0; }
private:
- void post_to_cef_ui_thread(std::function<void()> &&func);
+ void post_to_cef_ui_thread(std::function<void()> &&func, int64_t delay_ms = 0);
CefRefPtr<NageruCEFClient> cef_client;
std::string description, start_url;
std::atomic<int> max_fps{60};
- std::mutex browser_mutex;
+ // Needs to be recursive because the lambda in OnPaint could cause
+ // OnPaint itself to be called.
+ std::recursive_mutex browser_mutex;
CefRefPtr<CefBrowser> browser; // Under <browser_mutex>.
// Tasks waiting for <browser> to get ready. Under <browser_mutex>.