bool FWebBrowserSingleton::Tick(float DeltaTime) { #if WITH_CEF3 bool bIsSlateAwake = !FSlateApplication::Get().IsSlateAsleep(); // Remove any windows that have been deleted and check wether it's currently visible for (int32 Index = WindowInterfaces.Num() - 1; Index >= 0; --Index) { if (!WindowInterfaces[Index].IsValid()) { WindowInterfaces.RemoveAtSwap(Index); } else if (bIsSlateAwake) // only check for Tick activity if Slate is currently ticking { TSharedPtr<FWebBrowserWindow> BrowserWindow = WindowInterfaces[Index].Pin(); if(BrowserWindow.IsValid()) { // Test if we've ticked recently. If not assume the browser window has become hidden. BrowserWindow->CheckTickActivity(); } } } CefDoMessageLoopWork(); #endif return true; }
bool RenderHandler::frameStarted(const Ogre::FrameEvent &evt) //bool RenderHandler::frameStarted(void) { if (Ogre::Root::getSingletonPtr()->getAutoCreatedWindow() && Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()->isClosed()) { return false; } CefDoMessageLoopWork(); return true; }
bool frameStarted(const Ogre::FrameEvent &evt) { if (Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()->isClosed()) { return false; } m_renderNode->yaw(Ogre::Radian(evt.timeSinceLastFrame)*Ogre::Math::PI*2.*(1./10.)); // one turn in 10sec CefDoMessageLoopWork(); return true; }
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); breakpad_init(); setUserPWD(); CefSettings settings; #ifdef NDEBUG settings.log_severity = LOGSEVERITY_ERROR; #endif #ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP settings.multi_threaded_message_loop = false; #else settings.multi_threaded_message_loop = true; #endif if(!WindowsVersionOK()) { MessageBox(NULL,L"Pea Search only support Window XP, Vista and Win7 .", L"Pea Search Warn",MB_OK); return 0; } CefInitialize(settings); InitSchemeTest(); InitPlugin(); MyRegisterClass(hInstance); if (!InitInstance (hInstance, nCmdShow)) return FALSE; if(OleInitialize(NULL)!=S_OK) MessageBox(NULL,L"warn",L"ole init failed.",MB_OK); connect_named_pipe(); SetForegroundWindow(hMainWin); SetFocus(hMainWin); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { #ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP // Allow the CEF to do its message loop processing. CefDoMessageLoopWork(); #endif TranslateMessage(&msg); DispatchMessage(&msg); } close_named_pipe(); OleUninitialize(); CefShutdown(); return (int) msg.wParam; }
bool FWebBrowserSingleton::Tick(float DeltaTime) { #if WITH_CEF3 // Remove any windows that have been deleted for (int32 Index = WindowInterfaces.Num() - 1; Index >= 0; --Index) { if (!WindowInterfaces[Index].IsValid()) { WindowInterfaces.RemoveAtSwap(Index); } } CefDoMessageLoopWork(); #endif return true; }
bool CefMessageLoopDispatcher::Dispatch(const MSG &msg) { static BOOL bDoIdle = TRUE; TranslateMessage(&msg); DispatchMessage(&msg); if (IsIdleMessage(&msg)) { bDoIdle = TRUE; } while (bDoIdle && !::PeekMessage(const_cast<MSG*>(&msg), NULL, 0, 0, PM_NOREMOVE)) { CefDoMessageLoopWork(); bDoIdle = FALSE; } return true; }
bool MainMessageLoopExternalPump::PerformMessageLoopWork() { if (is_active_) { // When CefDoMessageLoopWork() is called there may be various callbacks // (such as paint and IPC messages) that result in additional calls to this // method. If re-entrancy is detected we must repost a request again to the // owner thread to ensure that the discarded call is executed in the future. reentrancy_detected_ = true; return false; } reentrancy_detected_ = false; is_active_ = true; CefDoMessageLoopWork(); is_active_ = false; // |reentrancy_detected_| may have changed due to re-entrant calls to this // method. return reentrancy_detected_; }
bool ClientHandler::frameStarted(const Ogre::FrameEvent &evt) { if (Ogre::Root::getSingletonPtr()->getAutoCreatedWindow()->isClosed()) { return false; } if (this->hasKeyBeenPressed) { if (this->repeatStarted && this->keyTimer->getMilliseconds() > 10) { this->browser->GetHost()->SendKeyEvent(this->keyEvent); this->keyTimer->reset(); } else if (this->keyTimer->getMilliseconds() > 500) { this->repeatStarted = true; this->browser->GetHost()->SendKeyEvent(this->keyEvent); this->keyTimer->reset(); } } CefDoMessageLoopWork(); return true; }
void Win32Host::RunLoop(const string & plugin_path) { #define TEST_SINGLE_THREADED_MESSAGE_LOOP #ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP // Initialize the CEF with messages processed using the current application's // message loop. settings.multi_threaded_message_loop = false; #else // Initialize the CEF with messages processed using a separate UI thread. settings.multi_threaded_message_loop = true; #endif // Setting private plugin path. CefString str(plugin_path); settings.extra_plugin_paths = cef_string_list_alloc(); cef_string_list_append(settings.extra_plugin_paths, str.GetStruct()); browserDefaults.web_security_disabled = true; // CefInitialize(settings, browserDefaults); HACCEL hAccelTable = NULL;// LoadAccelerators(::GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_blah)); MSG msg; // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { #ifdef TEST_SINGLE_THREADED_MESSAGE_LOOP // Allow the CEF to do its message loop processing. CefDoMessageLoopWork(); #endif if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } }
WebpageRendererPtr CEFManager::CreateWebpageRenderer(const std::string& url) { CefWindowInfo window_info; window_info.SetAsOffScreen(nullptr); window_info.SetTransparentPainting(true); // SimpleHandler implements browser-level callbacks. CefRefPtr<CEFWebpage> handler(new CEFWebpage); // Specify CEF browser settings here. CefBrowserSettings browser_settings; CefRefPtr<CefBrowser> pBrowser = CefBrowserHost::CreateBrowserSync(window_info, handler.get(), url, browser_settings, nullptr); while(pBrowser->IsLoading()) { CefDoMessageLoopWork(); } CEFWebpageRendererPtr pRenderer = alloc_object<CEFWebpageRenderer>(m_pCore, handler); return pRenderer; }
JNIEXPORT void JNICALL Java_org_embedded_browser_Chromium_browser_1message_1loop (JNIEnv *env, jobject jobj) { CefDoMessageLoopWork(); }
void CefLoop::RunLoop(uv_timer_t* handle, int status) { CefDoMessageLoopWork(); }
void CEFManager::Update() { CefDoMessageLoopWork(); }
void WebBrowserHost::HandleUpdate(StringHash eventType, VariantMap& eventData) { CefDoMessageLoopWork(); }