Skip to content

Conversation

michal-pichlinski-openfin
Copy link
Contributor

@michal-pichlinski-openfin michal-pichlinski-openfin commented Jun 26, 2023

Description of Change

viz::DisplayScheduler is responsible for drawing and swapping frames in the DisplayScheduler::DrawAndSwap which is called from the DisplayScheduler::AttemptDrawAndSwap if the DisplayScheduler::ShouldDraw returns true. ShouldDraw depends on the DisplayScheduler visibility and when it is not visible then it returns false.

In order to keep producing frames, disabling backgroundThrottling should also prevent changing DisplayScheduler visibility to false.

DisplayScheduler lives in the ui::Compositor where every electron::NativewWindow has its own Compositor. electron::NativewWindow may be host of the multiple electron::api::WebContents instances which may have different WebPreferences settings. Therefore if at least one of the WebContents requires disabling throttling then all other WebContents using the same window will have it disabled in the ui::Compositor.

BREAKING CHANGE:
backgroundThrottling set to false will disable frames throttling in the BrowserWindow for all WebContents displayed by it.

Closes: #31016

Checklist

Release Notes

Notes: Fixed generating frames when the window is hidden and backgroundThrottling is disabled.

`viz::DisplayScheduler` is responsible for drawing and swapping frames
in the `DisplayScheduler::DrawAndSwap` which is called from the
`DisplayScheduler::AttemptDrawAndSwap` if the `DisplayScheduler::ShouldDraw`
returns true. `ShouldDraw` depends on the `DisplayScheduler` visibility
and when it is not visible then it returns false.

In order to keep producing frames, disabling `backgroundThrottling`
should also prevent changing `DisplayScheduler` visibility to false.

`DisplayScheduler` lives in the `ui::Compositor` where every
`electron::NativewWindow` has its own `Compositor`. `electron::NativewWindow`
may be host of the multiple `electron::api::WebContents` instances which may
have different `WebPreferences` settings. Therefore if at least one
of the `WebContents` requires disabling throttling then all other `WebContents`
using the same window will have it disabled in the `ui::Compositor`.

BREAKING CHANGE:
`backgroundThrottling` set to false will disable frames throttling
in the `BrowserWindow` for all `WebContents` displayed by it.

Close: [electron#31016](electron#31016)
@michal-pichlinski-openfin michal-pichlinski-openfin requested a review from a team as a code owner June 26, 2023 17:13
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jun 26, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Jul 3, 2023
@codebytere codebytere added the semver/patch backwards-compatible bug fixes label Jul 10, 2023
Copy link
Contributor

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me.

/cc @electron/wg-upgrades to review the patch.

Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that Chromium would accept upstream in any form? it'd be good to have a roadmap for this patch that isn't us floating it indefinitely.

@michal-pichlinski-openfin
Copy link
Contributor Author

I've addressed all issues and resolved conflict.
build-linux issue seems unrelated to the change:

FAILED: obj/content/browser/browser/service_worker_info.o 
/home/builduser/project/build-tools/third_party/goma/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/content/browser/browser/service_worker_info.o.d -DDCHECK_ALWAYS_ON=1 -DUSE_UDEV -DUSE_AURA=1 -DUSE_GLIB=1 -DUSE_OZONE=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS=1 -DCR_CLANG_REVISION=\"llvmorg-17-init-12166-g7586aeab-3\" -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS -DCR_LIBCXX_REVISION=b272a1c128aae14ac6f77836a4df86dd353fd57e -DCR_SYSROOT_KEY=20230329T085712Z-1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DCONTENT_IMPLEMENTATION -DV8_USE_EXTERNAL_STARTUP_DATA -DIS_MAS_BUILD\(\)=0 -DATK_LIB_DIR=\"/usr/lib/x86_64-linux-gnu\" -DUSE_ATK_BRIDGE -DATSPI_MAJOR_VERSION=2 -DATSPI_MINOR_VERSION=44 -DATSPI_MICRO_VERSION=1 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 -DWEBP_EXTERN=extern -DUSE_EGL -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_WAYLAND_KHR -DLIBYUV_DISABLE_NEON -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DSK_ENABLE_SKSL -DSK_UNTIL_CRBUG_1187654_IS_FIXED -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_WIN_FONTMGR_NO_SIMULATIONS -DSK_DISABLE_LEGACY_SKSURFACE_METHODS -DSK_DISABLE_LEGACY_GRAPHITE_IMAGE_FACTORIES -DSK_DISABLE_LEGACY_GRAPHITE_IMAGE_METHODS -DSK_DISABLE_LEGACY_SKSURFACE_FACTORIES -DSK_DISABLE_LEGACY_SKSURFACE_FLUSH -DSK_DISABLE_LEGACY_SKSURFACE_AS_IMAGE -DSK_DISABLE_LEGACY_SKSURFACE_DISPLAYLIST -DSK_CODEC_DECODES_JPEG -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_JPEG -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_HAS_WUFFS_LIBRARY -DSK_GANESH -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DSK_GL -DSK_VULKAN=1 -DSK_GRAPHITE -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DGOOGLE_PROTOBUF_INTERNAL_DONATE_STEAL_INLINE=0 -DHAVE_PTHREAD -DLEVELDB_PLATFORM_CHROMIUM=1 -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_X11 -DWEBRTC_USE_PIPEWIRE -DWEBRTC_USE_GIO -DLOGGING_INSIDE_WEBRTC -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DCPPGC_POINTER_COMPRESSION -DCPPGC_SLIM_WRITE_BARRIER -DLIBGAV1_MAX_BITDEPTH=10 -DLIBGAV1_THREADPOOL_USE_STD_MUTEX -DLIBGAV1_ENABLE_LOGGING=0 -DLIBGAV1_PUBLIC= -DVK_NO_PROTOTYPES -DUSE_VULKAN_XCB -DSQLITE_OMIT_ANALYZE -DSQLITE_OMIT_AUTOINIT -DSQLITE_OMIT_AUTOMATIC_INDEX -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_EXPLAIN -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_INTROSPECTION_PRAGMAS -DSQLITE_DEFAULT_LOOKASIDE=0,0 -DSQLITE_OMIT_LOOKASIDE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_REINDEX -DSQLITE_OMIT_TRACE -DSQLITE_OMIT_UPSERT -DSQLITE_OMIT_WINDOWFUNC -DSQLITE_ENABLE_FTS3 -DSQLITE_DISABLE_FTS3_UNICODE -DSQLITE_DISABLE_FTS4_DEFERRED -DSQLITE_ENABLE_ICU -DSQLITE_SECURE_DELETE -DSQLITE_THREADSAFE=1 -DSQLITE_MAX_WORKER_THREADS=0 -DSQLITE_MAX_MMAP_SIZE=268435456 -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 -DSQLITE_DEFAULT_LOCKING_MODE=1 -DSQLITE_DEFAULT_MEMSTATUS=1 -DSQLITE_DEFAULT_PAGE_SIZE=4096 -DSQLITE_DEFAULT_PCACHE_INITSZ=0 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_USE_ALLOCA -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_JSON -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_HAVE_ISNAN -DSQLITE_HAVE_SQLITE3R -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_BATCH_ATOMIC_WRITE -DSQLITE_TEMP_STORE=3 -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_ENABLE_API_ARMOR -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../third_party/libwebp/src/src -I../../third_party/khronos -I../../gpu -I../../third_party/vulkan-deps/vulkan-headers/src/include -I../../third_party/wayland/src/src -I../../third_party/wayland/include/src -Igen/third_party/dawn/include -I../../third_party/dawn/include -I../../third_party/libyuv/include -I../../third_party/jsoncpp/source/include -Igen/third_party/private_membership/src -Igen/third_party/shell-encryption/src -Igen/components/policy/proto -I../../third_party/abseil-cpp -I../../third_party/boringssl/src/include -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/ipcz/include -I../../third_party/ced/src -I../../third_party/icu/source/common -I../../third_party/icu/source/i18n -I../../third_party/libwebm/source -I../../third_party/skia -Igen/third_party/skia -I../../third_party/wuffs/src/release/c -I../../third_party/vulkan/include -I../../third_party/mesa_headers -I../../third_party/leveldatabase -I../../third_party/leveldatabase/src -I../../third_party/leveldatabase/src/include -I../../third_party/crashpad/crashpad -I../../third_party/crashpad/crashpad/compat/linux -I../../third_party/crashpad/crashpad/compat/non_win -I../../third_party/zlib -I../../third_party/libaom/source/libaom -I../../net/third_party/quiche/overrides -I../../net/third_party/quiche/src/quiche/common/platform/default -I../../net/third_party/quiche/src -Igen/net/third_party/quiche/src -I../../third_party/webrtc_overrides -I../../third_party/webrtc -Igen/third_party/webrtc -Igen/third_party/metrics_proto -I../../v8/include -Igen/v8/include -I../../third_party/libgav1/src -I../../third_party/libgav1/src/src -I../../third_party/wayland/include -I../../third_party/wayland/src/cursor -I../../third_party/wayland/src/egl -Igen/third_party/wayland/src/protocol -I../../third_party/brotli/include -I../../third_party/distributed_point_functions -I../../third_party/distributed_point_functions/code -Igen/third_party/distributed_point_functions -I../../third_party/highway/src -I../../third_party/re2/src -I../../third_party/fontconfig/src -Wall -Werror -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wno-deprecated-this-capture -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -m64 -msse3 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O2 -fdata-sections -ffunction-sections -fno-unique-section-names -fno-omit-frame-pointer -gdwarf-4 -g1 -gdwarf-aranges -fvisibility=hidden -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Xclang -plugin-arg-find-bad-constructs -Xclang check-raw-ptr-fields -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=testing/platform_test.h -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=sandbox/mac/ -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_central_manager_mac.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/widget/native_widget_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-exclude-path=um/winnt.h -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/at-spi2-atk/2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/at-spi-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/dbus-1.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/dbus-1.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/atk-1.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/at-spi-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/dbus-1.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/dbus-1.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/pango-1.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/libmount -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/blkid -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/fribidi -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/harfbuzz -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/cairo -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/glib-2.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/pixman-1 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/uuid -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/libpng16 -Wno-redundant-parens -DPROTOBUF_ALLOW_DEPRECATED=1 -Wno-redundant-parens -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/nss -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/nspr -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/libdrm -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/include/dbus-1.0 -isystem../../build/linux/debian_bullseye_amd64-sysroot/usr/lib/x86_64-linux-gnu/dbus-1.0/include -std=c++20 -Wno-trigraphs -gsimple-template-names -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -c ../../content/browser/service_worker/service_worker_info.cc -o obj/content/browser/browser/service_worker_info.o
E20230714 07:35:20.436878 87645 goma_ipc.cc:241] GOMA: Unexpected end-of-file at 0+32768
E20230714 07:35:20.779918 87645 gomacc_common.cc:662] GOMA: IPC with compiler_proxy failed: GomaIPC::Status connect_success=1 err=-1 error_message=Unexpected end-of-file
Invalid HTTP response code: 0 http_return_code=0 req_size=12472 resp_size=0 req_send_time=40.005us resp_recv_time=0
E20230714 07:35:20.779951 87645 gomacc.cc:421] GOMA: compiler proxy not working

same with build-mac issue:

#!/bin/bash --login -eo pipefail
if [ ! -d "src/third_party/blink" ]; then
  echo src cache was not restored for some reason, idk what happened here...
  exit 1
fi

src cache was not restored for some reason, idk what happened here...

Exited with code exit status 1
CircleCI received exit code 1

I've no access to retry these builds.

@zcbenz zcbenz requested a review from codebytere August 1, 2023 06:20
@michal-pichlinski-openfin
Copy link
Contributor Author

Is this something that Chromium would accept upstream in any form? it'd be good to have a roadmap for this patch that isn't us floating it indefinitely.

I think this may have lower chances to upstream than allow_disabling_blink_scheduler_throttling_per_renderview.patch which exists from the Dec 2019, because disabling throttling in Compositor affects all WebContents displayed by it.

Copy link
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the patch needs to be updated.
You can update the patch by running:

e sync --3

and then running

e patches all

@michal-pichlinski-openfin
Copy link
Contributor Author

Looks like the patch needs to be updated. You can update the patch by running:

e sync --3

and then running

e patches all

Patches updated, builds failed on Get depot tools step with error:

error: repository lacks the necessary blob to perform 3-way merge.
Falling back to direct application...
error: patch failed: gclient.py:712
error: gclient.py: patch does not apply

@codebytere
Copy link
Member

@michal-pichlinski-openfin this has been fixed in latest main - you need to rebase

@jkleinsc jkleinsc added semver/major incompatible API changes and removed semver/patch backwards-compatible bug fixes labels Sep 14, 2023
Copy link
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michal-pichlinski-openfin michal-pichlinski-openfin requested a review from a team as a code owner September 15, 2023 05:25
@michal-pichlinski-openfin
Copy link
Contributor Author

Linux test runs failed due to: Forked prs not allowed to run on OSS projects.

@codebytere
Copy link
Member

@michal-pichlinski-openfin that's a flake that occasionally happens - could you please rebase on main?

@michal-pichlinski-openfin
Copy link
Contributor Author

This failure looks unrelated to my change:

        # Subtest: errors/force_colors.js
        not ok 18 - errors/force_colors.js
          ---
          duration_ms: 2169.073392
          failureType: 'testCodeFailure'
          error: |-
            Expected values to be strictly equal:
            + actual - expected ... Lines skipped
            
              '*force_colors.js:1\n' +
                "throw new Error('Should include grayed stack trace')\n" +
            ...
                '\x1B[90m    at Module.load (node:internal*modules*cjs*loader:1126:32)\x1B[39m\n' +
                '\x1B[90m    at Module._load (node:internal*modules*cjs*loader:967:12)\x1B[39m\n' +
            +   '\x1B[90m    at Module._load (node:electron*js2c*asar_bundle:763:32)\x1B[39m\n' +
            -   '\x1B[90m    at Module._load (node:electron*js2c*asar_bundle:777:32)\x1B[39m\n' +
                '\x1B[90m    at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:101:12)\x1B[39m\n' +
                '\x1B[90m    at node:internal*main*run_main_module:23:47\x1B[39m\n' +
                '\n' +
                'Node.js *\n'
          code: 'ERR_ASSERTION'
          name: 'AssertionError'
          expected: |-
            *force_colors.js:1
            throw new Error('Should include grayed stack trace')
            ^
            
            Error: Should include grayed stack trace
                at Object.<anonymous> (/test*force_colors.js:1:7)
                at Module._compile (node:internal*modules*cjs*loader:1271:14)
                at Module._extensions..js (node:internal*modules*cjs*loader:1326:10)
                at Module.load (node:internal*modules*cjs*loader:1126:32)
                at Module._load (node:internal*modules*cjs*loader:967:12)
                at Module._load (node:electron*js2c*asar_bundle:777:32)
                at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:101:12)
                at node:internal*main*run_main_module:23:47
            
            Node.js *
            
          actual: |-
            *force_colors.js:1
            throw new Error('Should include grayed stack trace')
            ^
            
            Error: Should include grayed stack trace
                at Object.<anonymous> (/test*force_colors.js:1:7)
                at Module._compile (node:internal*modules*cjs*loader:1271:14)
                at Module._extensions..js (node:internal*modules*cjs*loader:1326:10)
                at Module.load (node:internal*modules*cjs*loader:1126:32)
                at Module._load (node:internal*modules*cjs*loader:967:12)
                at Module._load (node:electron*js2c*asar_bundle:763:32)
                at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:101:12)
                at node:internal*main*run_main_module:23:47
            
            Node.js *
            
          operator: 'strictEqual'
          stack: |-
            assertSnapshot (/home/builduser/project/src/third_party/electron_node/test/common/assertSnapshot.js:38:12)
            async Module.spawnAndAssert (/home/builduser/project/src/third_party/electron_node/test/common/assertSnapshot.js:67:3)
            async TestContext.<anonymous> (file:///home/builduser/project/src/third_party/electron_node/test/parallel/test-node-output-errors.mjs:58:7)
            async Test.run (node:internal/test_runner/test:572:9)
            async Promise.all (index 17)
            async Suite.run (node:internal/test_runner/test:815:7)
            async startSubtest (node:internal/test_runner/harness:202:3)
          ...

@michal-pichlinski-openfin
Copy link
Contributor Author

@jkleinsc

The breaking change should be documented in https://github.com/electron/electron/blob/main/docs/breaking-changes.md

Addressed in: 4212433

Copy link
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@itsananderson
Copy link
Member

API LGTM

@welcome
Copy link

welcome bot commented Sep 26, 2023

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Sep 26, 2023

Release Notes Persisted

Setting backgroundThrottling to false will disable frames throttling in the BrowserWindow for all WebContents displayed by it.

@fanchenio
Copy link

Can this be updated to electron26?

@dsanders11
Copy link
Member

@fanchenio, this change included a breaking change, so it can not be backported to Electron 26.

MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
electron#38924)

* fix: disable background throttling also in the `viz::DisplayScheduler`

`viz::DisplayScheduler` is responsible for drawing and swapping frames
in the `DisplayScheduler::DrawAndSwap` which is called from the
`DisplayScheduler::AttemptDrawAndSwap` if the `DisplayScheduler::ShouldDraw`
returns true. `ShouldDraw` depends on the `DisplayScheduler` visibility
and when it is not visible then it returns false.

In order to keep producing frames, disabling `backgroundThrottling`
should also prevent changing `DisplayScheduler` visibility to false.

`DisplayScheduler` lives in the `ui::Compositor` where every
`electron::NativewWindow` has its own `Compositor`. `electron::NativewWindow`
may be host of the multiple `electron::api::WebContents` instances which may
have different `WebPreferences` settings. Therefore if at least one
of the `WebContents` requires disabling throttling then all other `WebContents`
using the same window will have it disabled in the `ui::Compositor`.

BREAKING CHANGE:
`backgroundThrottling` set to false will disable frames throttling
in the `BrowserWindow` for all `WebContents` displayed by it.

Close: [electron#31016](electron#31016)

* fixup! fix: disable background throttling also in the `viz::DisplayScheduler`

* fixup! fix: disable background throttling also in the `viz::DisplayScheduler`

* fixup! fix: disable background throttling also in the `viz::DisplayScheduler`

---------

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Disabling backgroundThrottling not working with hide() on Windows
7 participants