Advertisement
Guest User

Untitled

a guest
Jan 25th, 2021
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. void FCEFBrowserApp::OnScheduleMessagePumpWork(int64 delay_ms)
  2. {
  3.     FScopeLock Lock(&MessagePumpCountdownCS);
  4.  
  5.     if (MessagePumpCountdown == -1)
  6.     {
  7.         MessagePumpCountdown = delay_ms;
  8.     }
  9.     else
  10.     {
  11.         // override if we need the pump to happen sooner
  12.         MessagePumpCountdown = FMath::Clamp<int64>(MessagePumpCountdown, 0, delay_ms);
  13.     }
  14. }
  15.  
  16. // DeltaTime is a float, 1.0 = 1 second
  17. void FCEFBrowserApp::TickMessagePump(float DeltaTime, bool bForce)
  18. {
  19.     FScopeLock Lock(&MessagePumpCountdownCS);
  20.  
  21.     bool bPump = false;
  22.     // count down in order to call message pump
  23.     if (MessagePumpCountdown >= 0)
  24.     {
  25.         MessagePumpCountdown -= DeltaTime * 1000;
  26.         if (MessagePumpCountdown <= 0)
  27.         {
  28.             bPump = true;
  29.         }
  30.     }
  31.     if (bPump || bForce)
  32.     {
  33.         // -1 indicates that no countdown is currently happening
  34.         MessagePumpCountdown = -1;
  35.         CefDoMessageLoopWork();
  36.     }
  37. }
  38.  
  39. // From main loop
  40. // Tick and pass DeltaTime, force run if there are active browser windows
  41. TickMessagePump(DeltaTime, WindowInterfaces.Num() > 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement