Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 467d7dd6f1ea3e0b36eb4e3c01869663b066831a
      
https://github.com/WebKit/WebKit/commit/467d7dd6f1ea3e0b36eb4e3c01869663b066831a
  Author: Basuke Suzuki <[email protected]>
  Date:   2024-11-06 (Wed, 06 Nov 2024)

  Changed paths:
    M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.h
    M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm
    M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEngines.h
    M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEngines.mm

  Log Message:
  -----------
  [macOS] Send playEffect() twice to Gamepad.actuator and it cannot stop with 
reset()
https://bugs.webkit.org/show_bug.cgi?id=279094
rdar://126589062

Reviewed by Chris Dumez.

When sending playEffect() to Gamepad.actuator more than once, the reset() 
cannot stop the gamepad from vibrating.

The root cause of the issue is requesting a completionHandler invocation to 
wrong effect object.
Say two sequential playEffect requests is coming.

1. The effect object of request 1 is stored in m_currentDualRumbleEffect and 
referenced by currentEffect in playEffect() method.
2. In second playEffect(), currentEffect is stopped  before start playing 
second one. This is in main thread.
3. Notification for stopPlaying is called for first request {*) in CoreHaptics 
thread.
4. currentEffect is replaced with new effect.
5. Notification arrived in main thread and try to invoke completionHandler 
targeting to second request. This is wrong because the notification is for 
first request.

Move the play logic from GameControllerHapticEngines to 
GameControllerHapticEffect to avoid this confusion.

* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.h:
* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm:
(WebCore::GameControllerHapticEffect::create):
(WebCore::GameControllerHapticEffect::GameControllerHapticEffect):
(WebCore::GameControllerHapticEffect::~GameControllerHapticEffect):
(WebCore::GameControllerHapticEffect::start):
(WebCore::GameControllerHapticEffect::ensureStarted):
(WebCore::GameControllerHapticEffect::startEngine):
(WebCore::GameControllerHapticEffect::registerNotification):
(WebCore::GameControllerHapticEffect::stop):
(WebCore::GameControllerHapticEffect::leftEffectFinishedPlaying): Deleted.
(WebCore::GameControllerHapticEffect::rightEffectFinishedPlaying): Deleted.
* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEngines.h:
* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEngines.mm:
(WebCore::GameControllerHapticEngines::create):
(WebCore::GameControllerHapticEngines::playEffect):
(WebCore::GameControllerHapticEngines::ensureStarted): Deleted.

Canonical link: https://commits.webkit.org/286251@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to