tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 7bb2cd79ab0c473d1f94c46af9711f08acd463cf
parent 046678d6f69fe960345289d70a50ea99f232b595
Author: Teodor Tanasoaia <ttanasoaia@mozilla.com>
Date:   Fri, 12 Dec 2025 09:48:04 +0000

Bug 2005383 - Replace `static_cast` with `switch`. r=webgpu-reviewers,ErichDonGubler

Differential Revision: https://phabricator.services.mozilla.com/D275940

Diffstat:
Mdom/webgpu/Instance.cpp | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/dom/webgpu/Instance.cpp b/dom/webgpu/Instance.cpp @@ -214,10 +214,18 @@ already_AddRefed<dom::Promise> Instance::RequestAdapter( ffi::WGPUPowerPreference power_preference; if (aOptions.mPowerPreference.WasPassed()) { - power_preference = static_cast<ffi::WGPUPowerPreference>( - aOptions.mPowerPreference.Value()); + switch (aOptions.mPowerPreference.Value()) { + case dom::GPUPowerPreference::Low_power: + power_preference = ffi::WGPUPowerPreference_LowPower; + break; + case dom::GPUPowerPreference::High_performance: + power_preference = ffi::WGPUPowerPreference_HighPerformance; + break; + default: + MOZ_CRASH("Unexpected `dom::GPUPowerPreference`"); + } } else { - power_preference = ffi::WGPUPowerPreference_LowPower; + power_preference = ffi::WGPUPowerPreference_None; } RawId adapter_id = ffi::wgpu_client_request_adapter(