Chromium Embedded Framework (CEF) 中绑定函数和方法的执行示例
// Include the necessary headers.\n#include "include/base/cef_callback.h"\n#include "include/wrapper/cef_closure_task.h"\n\n// To execute a bound function:\n\n// Define a function.\nvoid MyFunc(int arg) { /* do something with |arg| on the UI thread / }\n\n// Post a task that will execute MyFunc on the UI thread and pass an |arg|\n// value of 5.\nCefPostTask(TID_UI, base::BindOnce(&MyFunc, 5));\n\n// To execute a bound method:\n\n// Define a class.\nclass MyClass : public CefBaseRefCounted {\n public:\n MyClass() {}\n void MyMethod(int arg) { / do something with |arg| on the UI thread */ }\n private:\n IMPLEMENT_REFCOUNTING(MyClass);\n};\n\n// Create an instance of MyClass.\nCefRefPtr
原文地址: https://www.cveoy.top/t/topic/pJDT 著作权归作者所有。请勿转载和采集!