Commit 043469f8 authored by Matt Reynolds's avatar Matt Reynolds Committed by Commit Bot

Add a GamepadVibration runtime feature flag

In previous versions, the vibration feature was enabled with the
GamepadExtensions runtime feature flag. This CL splits the vibration
functionality into a separate flag that is enabled by default. This
allows the vibration feature to be enabled independently of other
features that use the same runtime flag.

BUG=749295

Change-Id: Ia8017e8b0ecd9df4490e8b205ecd1f49509c687b
Reviewed-on: https://chromium-review.googlesource.com/1027996Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555211}
parent 2ca6c340
...@@ -2216,6 +2216,9 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -2216,6 +2216,9 @@ const FeatureEntry kFeatureEntries[] = {
{"enable-gamepad-extensions", flag_descriptions::kGamepadExtensionsName, {"enable-gamepad-extensions", flag_descriptions::kGamepadExtensionsName,
flag_descriptions::kGamepadExtensionsDescription, kOsAll, flag_descriptions::kGamepadExtensionsDescription, kOsAll,
FEATURE_VALUE_TYPE(features::kGamepadExtensions)}, FEATURE_VALUE_TYPE(features::kGamepadExtensions)},
{"enable-gamepad-vibration", flag_descriptions::kGamepadVibrationName,
flag_descriptions::kGamepadVibrationDescription, kOsAll,
FEATURE_VALUE_TYPE(features::kGamepadVibration)},
{"enable-webvr", flag_descriptions::kWebvrName, {"enable-webvr", flag_descriptions::kWebvrName,
flag_descriptions::kWebvrDescription, kOsAll, flag_descriptions::kWebvrDescription, kOsAll,
SINGLE_VALUE_TYPE(switches::kEnableWebVR)}, SINGLE_VALUE_TYPE(switches::kEnableWebVR)},
......
...@@ -799,6 +799,9 @@ const char kFramebustingDescription[] = ...@@ -799,6 +799,9 @@ const char kFramebustingDescription[] =
const char kGamepadExtensionsName[] = "Gamepad Extensions"; const char kGamepadExtensionsName[] = "Gamepad Extensions";
const char kGamepadExtensionsDescription[] = const char kGamepadExtensionsDescription[] =
"Enables experimental extensions to the Gamepad APIs."; "Enables experimental extensions to the Gamepad APIs.";
const char kGamepadVibrationName[] = "Gamepad Vibration";
const char kGamepadVibrationDescription[] =
"Enables haptic vibration effects on supported gamepads.";
const char kGpuRasterizationMsaaSampleCountName[] = const char kGpuRasterizationMsaaSampleCountName[] =
"GPU rasterization MSAA sample count."; "GPU rasterization MSAA sample count.";
......
...@@ -505,6 +505,8 @@ extern const char kFramebustingDescription[]; ...@@ -505,6 +505,8 @@ extern const char kFramebustingDescription[];
extern const char kGamepadExtensionsName[]; extern const char kGamepadExtensionsName[];
extern const char kGamepadExtensionsDescription[]; extern const char kGamepadExtensionsDescription[];
extern const char kGamepadVibrationName[];
extern const char kGamepadVibrationDescription[];
extern const char kGpuRasterizationMsaaSampleCountName[]; extern const char kGpuRasterizationMsaaSampleCountName[];
extern const char kGpuRasterizationMsaaSampleCountDescription[]; extern const char kGpuRasterizationMsaaSampleCountDescription[];
......
...@@ -304,6 +304,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( ...@@ -304,6 +304,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
if (base::FeatureList::IsEnabled(features::kGamepadExtensions)) if (base::FeatureList::IsEnabled(features::kGamepadExtensions))
WebRuntimeFeatures::EnableGamepadExtensions(true); WebRuntimeFeatures::EnableGamepadExtensions(true);
if (base::FeatureList::IsEnabled(features::kGamepadVibration))
WebRuntimeFeatures::EnableGamepadVibration(true);
if (base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition)) if (base::FeatureList::IsEnabled(features::kCompositeOpaqueFixedPosition))
WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueFixedPosition", WebRuntimeFeatures::EnableFeatureFromString("CompositeOpaqueFixedPosition",
true); true);
......
...@@ -134,6 +134,11 @@ const base::Feature kFramebustingNeedsSameOriginOrUserGesture{ ...@@ -134,6 +134,11 @@ const base::Feature kFramebustingNeedsSameOriginOrUserGesture{
// Enables extended Gamepad API features like motion tracking and haptics. // Enables extended Gamepad API features like motion tracking and haptics.
const base::Feature kGamepadExtensions{"GamepadExtensions", const base::Feature kGamepadExtensions{"GamepadExtensions",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Enables haptic vibration effects on supported gamepads.
const base::Feature kGamepadVibration{"GamepadVibration",
base::FEATURE_ENABLED_BY_DEFAULT};
// When WebXR Device API is enabled, exposes VR controllers as Gamepads and // When WebXR Device API is enabled, exposes VR controllers as Gamepads and
// enables additional Gamepad attributes for use with WebXR Device API. Each // enables additional Gamepad attributes for use with WebXR Device API. Each
// XRInputSource will have a corresponding Gamepad instance. // XRInputSource will have a corresponding Gamepad instance.
......
...@@ -40,6 +40,7 @@ CONTENT_EXPORT extern const base::Feature kFontCacheScaling; ...@@ -40,6 +40,7 @@ CONTENT_EXPORT extern const base::Feature kFontCacheScaling;
CONTENT_EXPORT extern const base::Feature CONTENT_EXPORT extern const base::Feature
kFramebustingNeedsSameOriginOrUserGesture; kFramebustingNeedsSameOriginOrUserGesture;
CONTENT_EXPORT extern const base::Feature kGamepadExtensions; CONTENT_EXPORT extern const base::Feature kGamepadExtensions;
CONTENT_EXPORT extern const base::Feature kGamepadVibration;
CONTENT_EXPORT extern const base::Feature kGuestViewCrossProcessFrames; CONTENT_EXPORT extern const base::Feature kGuestViewCrossProcessFrames;
CONTENT_EXPORT extern const base::Feature kHeapCompaction; CONTENT_EXPORT extern const base::Feature kHeapCompaction;
CONTENT_EXPORT extern const base::Feature kImageCaptureAPI; CONTENT_EXPORT extern const base::Feature kImageCaptureAPI;
......
...@@ -13,13 +13,12 @@ To test whether the token is working, run virtual/origin-trials-runtimeflags-dis ...@@ -13,13 +13,12 @@ To test whether the token is working, run virtual/origin-trials-runtimeflags-dis
const token="AjBmNGyEfNhgv1i84o2MDXzBna5hynT2UdRWh24E6smvQuM6lTjdHiORSsixiR6wo8A4AZofrxgIT6RYIjwg2AMAAABTeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiV2ViVlIxLjFNNjIiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0="; const token="AjBmNGyEfNhgv1i84o2MDXzBna5hynT2UdRWh24E6smvQuM6lTjdHiORSsixiR6wo8A4AZofrxgIT6RYIjwg2AMAAABTeyJvcmlnaW4iOiAiaHR0cDovLzEyNy4wLjAuMTo4MDAwIiwgImZlYXR1cmUiOiAiV2ViVlIxLjFNNjIiLCAiZXhwaXJ5IjogMjAwMDAwMDAwMH0=";
properties_to_check = { properties_to_check = {
'Gamepad': ['pose', 'vibrationActuator', 'hand', 'displayId'], 'Gamepad': ['pose', 'hand', 'displayId'],
'GamepadButton': ['touched'], 'GamepadButton': ['touched'],
}; };
interfaces_to_check = [ interfaces_to_check = [
'GamepadPose', 'GamepadPose'
'GamepadHapticActuator'
]; ];
// Skip this test if flags are not set properly. // Skip this test if flags are not set properly.
...@@ -52,8 +51,7 @@ test(t => { ...@@ -52,8 +51,7 @@ test(t => {
'orientation', 'orientation',
'angularVelocity', 'angularVelocity',
'angularAcceleration' 'angularAcceleration'
], ]
'GamepadHapticActuator': ['type', 'playEffect', 'reset']
}); });
}, 'Additional Gamepad Extensions interfaces and their properties are available.'); }, 'Additional Gamepad Extensions interfaces and their properties are available.');
......
...@@ -1752,6 +1752,7 @@ interface Gamepad ...@@ -1752,6 +1752,7 @@ interface Gamepad
getter index getter index
getter mapping getter mapping
getter timestamp getter timestamp
getter vibrationActuator
method constructor method constructor
interface GamepadButton interface GamepadButton
attribute @@toStringTag attribute @@toStringTag
...@@ -1762,6 +1763,12 @@ interface GamepadEvent : Event ...@@ -1762,6 +1763,12 @@ interface GamepadEvent : Event
attribute @@toStringTag attribute @@toStringTag
getter gamepad getter gamepad
method constructor method constructor
interface GamepadHapticActuator
attribute @@toStringTag
getter type
method constructor
method playEffect
method reset
interface Gyroscope : Sensor interface Gyroscope : Sensor
attribute @@toStringTag attribute @@toStringTag
getter x getter x
......
...@@ -83,6 +83,7 @@ class WebRuntimeFeatures { ...@@ -83,6 +83,7 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableFileSystem(bool); BLINK_PLATFORM_EXPORT static void EnableFileSystem(bool);
BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool); BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool);
BLINK_PLATFORM_EXPORT static void EnableGamepadExtensions(bool); BLINK_PLATFORM_EXPORT static void EnableGamepadExtensions(bool);
BLINK_PLATFORM_EXPORT static void EnableGamepadVibration(bool);
BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool);
BLINK_PLATFORM_EXPORT static void EnableGenericSensorExtraClasses(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensorExtraClasses(bool);
BLINK_PLATFORM_EXPORT static void EnableHeapCompaction(bool); BLINK_PLATFORM_EXPORT static void EnableHeapCompaction(bool);
......
...@@ -40,9 +40,8 @@ interface Gamepad { ...@@ -40,9 +40,8 @@ interface Gamepad {
[CachedAttribute=isButtonDataDirty, MeasureAs=GamepadButtons] readonly attribute FrozenArray<GamepadButton> buttons; [CachedAttribute=isButtonDataDirty, MeasureAs=GamepadButtons] readonly attribute FrozenArray<GamepadButton> buttons;
// Gamepad vibration is proposed as an extension to the Gamepad API. // Gamepad vibration is proposed as an extension to the Gamepad API.
// https://docs.google.com/document/d/1jPKzVRNzzU4dUsvLpSXm1VXPQZ8FP-0lKMT-R_p-s6g // https://github.com/w3c/gamepad/pull/68
// TODO(mattreynolds): Replace this with a link to w3c.github.io/gamepad [RuntimeEnabled=GamepadVibration, MeasureAs=GamepadVibrationActuator] readonly attribute GamepadHapticActuator? vibrationActuator;
[OriginTrialEnabled=GamepadExtensions, MeasureAs=GamepadVibrationActuator] readonly attribute GamepadHapticActuator? vibrationActuator;
[OriginTrialEnabled=GamepadExtensions, MeasureAs=GamepadPose] readonly attribute GamepadPose? pose; [OriginTrialEnabled=GamepadExtensions, MeasureAs=GamepadPose] readonly attribute GamepadPose? pose;
[OriginTrialEnabled=WebXRGamepadSupport, MeasureAs=GamepadHand] readonly attribute GamepadHand hand; [OriginTrialEnabled=WebXRGamepadSupport, MeasureAs=GamepadHand] readonly attribute GamepadHand hand;
......
...@@ -20,10 +20,9 @@ enum GamepadHapticsResult { ...@@ -20,10 +20,9 @@ enum GamepadHapticsResult {
}; };
// Gamepad vibration is proposed as an extension to the Gamepad API. // Gamepad vibration is proposed as an extension to the Gamepad API.
// https://docs.google.com/document/d/1jPKzVRNzzU4dUsvLpSXm1VXPQZ8FP-0lKMT-R_p-s6g // https://github.com/w3c/gamepad/pull/68
// TODO(mattreynolds): Replace this with a link to w3c.github.io/gamepad
[ [
OriginTrialEnabled=GamepadExtensions RuntimeEnabled=GamepadVibration
] interface GamepadHapticActuator { ] interface GamepadHapticActuator {
readonly attribute GamepadHapticActuatorType type; readonly attribute GamepadHapticActuatorType type;
[CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect( [CallWith=ScriptState] Promise<GamepadHapticsResult> playEffect(
......
...@@ -140,6 +140,10 @@ void WebRuntimeFeatures::EnableGamepadExtensions(bool enable) { ...@@ -140,6 +140,10 @@ void WebRuntimeFeatures::EnableGamepadExtensions(bool enable) {
RuntimeEnabledFeatures::SetGamepadExtensionsEnabled(enable); RuntimeEnabledFeatures::SetGamepadExtensionsEnabled(enable);
} }
void WebRuntimeFeatures::EnableGamepadVibration(bool enable) {
RuntimeEnabledFeatures::SetGamepadVibrationEnabled(enable);
}
void WebRuntimeFeatures::EnableGenericSensor(bool enable) { void WebRuntimeFeatures::EnableGenericSensor(bool enable) {
RuntimeEnabledFeatures::SetSensorEnabled(enable); RuntimeEnabledFeatures::SetSensorEnabled(enable);
} }
......
...@@ -546,6 +546,10 @@ ...@@ -546,6 +546,10 @@
origin_trial_feature_name: "WebVR1.1M62", origin_trial_feature_name: "WebVR1.1M62",
status: "experimental", status: "experimental",
}, },
{
name: "GamepadVibration",
status: "experimental",
},
{ {
name: "GeometryInterfaces", name: "GeometryInterfaces",
status: "stable", status: "stable",
......
...@@ -27114,6 +27114,7 @@ from previous Chrome versions. ...@@ -27114,6 +27114,7 @@ from previous Chrome versions.
<int value="-279493876" label="WebVRExperimentalRendering:enabled"/> <int value="-279493876" label="WebVRExperimentalRendering:enabled"/>
<int value="-278347667" label="default-tile-height"/> <int value="-278347667" label="default-tile-height"/>
<int value="-277144896" label="enable-viewport-meta"/> <int value="-277144896" label="enable-viewport-meta"/>
<int value="-276260362" label="GamepadVibration:enabled"/>
<int value="-275870837" <int value="-275870837"
label="OmniboxUIExperimentHideSuggestionUrlPath:enabled"/> label="OmniboxUIExperimentHideSuggestionUrlPath:enabled"/>
<int value="-275619817" <int value="-275619817"
...@@ -27906,6 +27907,7 @@ from previous Chrome versions. ...@@ -27906,6 +27907,7 @@ from previous Chrome versions.
<int value="1586022426" label="AutofillCreditCardAssist:enabled"/> <int value="1586022426" label="AutofillCreditCardAssist:enabled"/>
<int value="1589341623" label="disable-easy-unlock"/> <int value="1589341623" label="disable-easy-unlock"/>
<int value="1591653786" label="SpeculativePreconnect:enabled"/> <int value="1591653786" label="SpeculativePreconnect:enabled"/>
<int value="1593720927" label="GamepadVibration:disabled"/>
<int value="1594247626" label="ContentSuggestionsSettings:enabled"/> <int value="1594247626" label="ContentSuggestionsSettings:enabled"/>
<int value="1594664550" label="NTPModernLayout:enabled"/> <int value="1594664550" label="NTPModernLayout:enabled"/>
<int value="1600926040" label="TranslateCompactUI:enabled"/> <int value="1600926040" label="TranslateCompactUI:enabled"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment