From c174ed70f5dff323bb83647d984393273e709928 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 21:15:08 -0500 Subject: [PATCH] fix: WebUSB on ARM64 macs (#37521) * fix: WebUSB on ARM64 macs Co-authored-by: John Kleinschmidt * chore: update patches --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --- patches/chromium/.patches | 1 + ...devices_request_until_usb_service_is.patch | 23 +++++++++++++++++++ shell/browser/feature_list.cc | 5 ---- 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 patches/chromium/chore_defer_usb_service_getdevices_request_until_usb_service_is.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 34fe0d83254c8..150dacaf66da5 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -126,3 +126,4 @@ chore_patch_out_partition_attribute_dcheck_for_webviews.patch expose_v8initializer_codegenerationcheckcallbackinmainthread.patch chore_patch_out_profile_methods_in_profile_selections_cc.patch fix_x11_window_restore_minimized_maximized_window.patch +chore_defer_usb_service_getdevices_request_until_usb_service_is.patch diff --git a/patches/chromium/chore_defer_usb_service_getdevices_request_until_usb_service_is.patch b/patches/chromium/chore_defer_usb_service_getdevices_request_until_usb_service_is.patch new file mode 100644 index 0000000000000..79d3b5820f1e3 --- /dev/null +++ b/patches/chromium/chore_defer_usb_service_getdevices_request_until_usb_service_is.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: John Kleinschmidt +Date: Thu, 2 Mar 2023 15:26:46 -0500 +Subject: chore: defer USB service GetDevices request until USB service is + ready. + +On macOS we need to wait until the USB service is ready before the list of +devices is available. This should no longer be necessary if/when +https://crbug.com/1096743 is completed. + +diff --git a/services/device/usb/usb_service_impl.cc b/services/device/usb/usb_service_impl.cc +index 9acfb687b85986c2f2ba787e7b67556092a714d2..244fe386e499930e9a9f031edae216bb18b6fc4e 100644 +--- a/services/device/usb/usb_service_impl.cc ++++ b/services/device/usb/usb_service_impl.cc +@@ -198,7 +198,7 @@ void UsbServiceImpl::GetDevices(GetDevicesCallback callback) { + return; + } + +- if (enumeration_in_progress_) { ++ if (enumeration_in_progress_ || !enumeration_ready_) { + pending_enumeration_callbacks_.push_back(std::move(callback)); + return; + } diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index 0cf9374876bcd..ea4c74c52c253 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -36,11 +36,6 @@ void InitializeFeatureList() { disable_features += std::string(",") + features::kSpareRendererForSitePerProcess.name; -#if BUILDFLAG(IS_MAC) - // Needed for WebUSB implementation - enable_features += std::string(",") + device::kNewUsbBackend.name; -#endif - #if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE) disable_features += std::string(",") + media::kPictureInPicture.name; #endif