Skip to content

disable-renderer-backgrounding command line switch not working #4317

Closed

Description

@brian-mann

I am running this prior to instantiating any BrowserWindow objects.

app.commandLine.appendSwitch("disable-renderer-backgrounding")

But as soon as I minimize the app or just background it (by bringing another app in front) I can tell it is immediately throttled which causes all kinds of problems in my app.

In my situation I have a multi-window app, but as per #3225 (comment) I believe I'm doing it correctly.

Activity

  1. zcbenz commented on Feb 2, 2016

    @zcbenz
    Contributor

    My original comment can be wrong since I didn't test it, the safest choice is to put it before the ready event of app. For per window you can take the WebAudio hack.

  2. brian-mann commented on Feb 2, 2016

    @brian-mann
    Author

    I am putting it before the ready event.

    app        = require("electron").app
    init       = require("./handlers/init")
    
    ## prevent chromium from throttling
    app.commandLine.appendSwitch("disable-renderer-backgrounding")
    
    module.exports = ->
      app.on "ready", ->
        ## ...do things...

    I will try the audio hack as well.

  3. brian-mann commented on Feb 2, 2016

    @brian-mann
    Author

    I implemented:

      var context = new AudioContext()
      var source = context.createBufferSource()
      source.connect(context.destination)
      source.start(0)

    And I still see my process being backgrounded both in Chrome 48 and in Electron 0.36.7.

    I can tell it is being backgrounded because I'm using Promises everywhere and they go from taking 0.004 sec each turn of the run loop up to 1 sec.

  4. zcbenz commented on Feb 2, 2016

    @zcbenz
    Contributor

    @brian-mann Can you make a test case for it? It is probably caused by other things since disable-renderer-backgrounding did work for other people.

  5. brian-mann commented on Feb 4, 2016

    @brian-mann
    Author

    I'll see about getting this together. I agree - need to reduce the case.

  6. nathansobo commented on Mar 2, 2016

    @nathansobo

    @zcbenz: I can confirm that this is broken, so I'm going to reopen the issue. I've created a test case repository that demonstrates animation frames taking multiple seconds to fire even when using the --disable-renderer-backgrounding flag and the web audio hack.

    Here's where this comes up in Atom. Here's two test suite windows that were started at the same time, except one was hidden and therefore throttled:

    screen shot 2016-03-01 at 3 13 17 pm

    More importantly, this is causing problems on CI such as this one.

    It would be great if we could find some way to make sure pages don't get throttled. If I'm doing something wrong in my example, please let me know.

  7. zcbenz commented on Mar 5, 2016

    @zcbenz
    Contributor

    @nathansobo It is actually another issue, disable-renderer-backgrounding did prevent lowering the priority of renderer process, however for background pages Chromium has another throttling system for animations, I'll try to find a way to disable it.

  8. nathansobo commented on Mar 9, 2016

    @nathansobo

    @zcbenz should we file an issue with the Chrome team about adding another flag? Is something you could maybe hack in?

  9. zcbenz commented on Mar 9, 2016

    @zcbenz
    Contributor

    @nathansobo I tried to patch a few places related to throttling but none of them works for animations, so filing an issue would probably be the only choice.

  10. zcbenz commented on Mar 27, 2016

    @zcbenz
    Contributor

    I have created #4925 for the requestAnimationFrame throttling problem, closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions