Throttling application when in background

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Throttling application when in background

Postby damonkashu » Wed Jan 11, 2017 8:22 pm

Does CEF automatically throttle rendering, javascript, or anything at all when it is in the background or minimized?

I'd like to optimize our application's performance when backgrounded/minimized, and I want to ensure CEF or chromium isn't already doing that for me.

If there are other ways I can forcibly throttle my application to throttle to a slower update rate, that would be great.
damonkashu
Techie
 
Posts: 16
Joined: Tue May 24, 2016 8:26 pm

Re: Throttling application when in background

Postby damonkashu » Thu Jan 12, 2017 12:35 am

Note, I am not using OSR, though from what I'm reading, it may give me more flexibility over controlling this?
damonkashu
Techie
 
Posts: 16
Joined: Tue May 24, 2016 8:26 pm

Re: Throttling application when in background

Postby Czarek » Thu Jan 12, 2017 3:57 am

Set browser window size to 0x0, see https://github.com/cztomczak/phpdesktop/issues/179
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Throttling application when in background

Postby magreenblatt » Thu Jan 12, 2017 9:56 am

What platform are you using?

If the browser is part of a normal window hierarchy then it will reduce resource usage when it receives the platform-specific window hide notification. You can see this in action by watching CPU usage when you load https://webkit.org/blog-files/3d-transf ... ircle.html in cefclient and then minimize the window.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Throttling application when in background

Postby damonkashu » Thu Jan 12, 2017 2:04 pm

I am testing my application on windows 7 and 10. Indeed it is part of the normal window hierarchy.

Is minimizing going to achieve the same effect as setting the window size to 0x0?
damonkashu
Techie
 
Posts: 16
Joined: Tue May 24, 2016 8:26 pm

Re: Throttling application when in background

Postby magreenblatt » Thu Jan 12, 2017 2:50 pm

damonkashu wrote:I am testing my application on windows 7 and 10. Indeed it is part of the normal window hierarchy.

Is minimizing going to achieve the same effect as setting the window size to 0x0?

It should, yes.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Throttling application when in background

Postby merceyz » Thu Jan 12, 2017 3:59 pm

I'm using an OffScreen instance, is there a "simple" way to turn rendering on/off?

I only require it to render so I can take a screenshot of the page, not while loading etc.

I already tried setting the window size to 0x0 and calling WasHidden(true/false) but neither gave me the result I was after.

I would also like to disable CSS Transitions and Animations (go to 100% instantly and no looping), since it's OffScreen smoothness and animations isn't really necessary.
merceyz
Newbie
 
Posts: 8
Joined: Thu Jan 12, 2017 3:34 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 100 guests