Skip to content

Commit 289fbf2

Browse files
committed
Update WinFormsBrowserProcessHandler to use the simplest possible approach - NOT PRODUCTION READY
1 parent 98f1ded commit 289fbf2

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

CefSharp.WinForms.Example/Handlers/WinFormsBrowserProcessHandler.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,18 @@ public WinFormsBrowserProcessHandler(TaskScheduler scheduler)
2929

3030
private void TimerTick(object sender, EventArgs e)
3131
{
32-
//Reset the timer interval to maximum
33-
timer.Interval = MaxTimerDelay;
34-
32+
//Basically execute Cef.DoMessageLoopWork 30 times per second
3533
//Execute DoMessageLoopWork on UI thread
3634
factory.StartNew(() => Cef.DoMessageLoopWork());
3735
}
3836

3937
protected override void OnScheduleMessagePumpWork(int delay)
4038
{
41-
//Basically execute Cef.DoMessageLoopWork 30 times per second,
42-
//when delay <= 0 set the timer interval to really small so it's executed
43-
// relatively quickly.
39+
//when delay <= 0 queue the Task up for execution on the UI thread.
4440
if(delay <= 0)
4541
{
4642
//Update the timer to execute almost immediately
47-
timer.Interval = 1;
48-
}
49-
else
50-
{
51-
timer.Interval = delay;
43+
factory.StartNew(() => Cef.DoMessageLoopWork());
5244
}
5345
}
5446

0 commit comments

Comments
 (0)