diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-13 13:33:08 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-18 10:57:53 +0000 |
commit | 5744d59188e9efc89e48a5ccbaf42ecafd6faa15 (patch) | |
tree | ae4e0283a677330c2f912c2af7b96140cf86e5e4 /hal/Hal.cpp | |
parent | 45a976a5f1e83c3c2f7fcf85b1fa5315946f4c1a (diff) | |
download | UXP-5744d59188e9efc89e48a5ccbaf42ecafd6faa15.tar UXP-5744d59188e9efc89e48a5ccbaf42ecafd6faa15.tar.gz UXP-5744d59188e9efc89e48a5ccbaf42ecafd6faa15.tar.lz UXP-5744d59188e9efc89e48a5ccbaf42ecafd6faa15.tar.xz UXP-5744d59188e9efc89e48a5ccbaf42ecafd6faa15.zip |
Issue #1682 - Remove vibrator DOM interface and support code.
Diffstat (limited to 'hal/Hal.cpp')
-rw-r--r-- | hal/Hal.cpp | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/hal/Hal.cpp b/hal/Hal.cpp index 981f49125..bd5ba9189 100644 --- a/hal/Hal.cpp +++ b/hal/Hal.cpp @@ -95,87 +95,8 @@ WindowIsActive(nsPIDOMWindowInner* aWindow) return !document->Hidden(); } -StaticAutoPtr<WindowIdentifier::IDArrayType> gLastIDToVibrate; - -void InitLastIDToVibrate() -{ - gLastIDToVibrate = new WindowIdentifier::IDArrayType(); - ClearOnShutdown(&gLastIDToVibrate); -} - } // namespace -void -Vibrate(const nsTArray<uint32_t>& pattern, nsPIDOMWindowInner* window) -{ - Vibrate(pattern, WindowIdentifier(window)); -} - -void -Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id) -{ - AssertMainThread(); - - // Only active windows may start vibrations. If |id| hasn't gone - // through the IPC layer -- that is, if our caller is the outside - // world, not hal_proxy -- check whether the window is active. If - // |id| has gone through IPC, don't check the window's visibility; - // only the window corresponding to the bottommost process has its - // visibility state set correctly. - if (!id.HasTraveledThroughIPC() && !WindowIsActive(id.GetWindow())) { - HAL_LOG("Vibrate: Window is inactive, dropping vibrate."); - return; - } - - if (!InSandbox()) { - if (!gLastIDToVibrate) { - InitLastIDToVibrate(); - } - *gLastIDToVibrate = id.AsArray(); - } - - // Don't forward our ID if we are not in the sandbox, because hal_impl - // doesn't need it, and we don't want it to be tempted to read it. The - // empty identifier will assert if it's used. - PROXY_IF_SANDBOXED(Vibrate(pattern, InSandbox() ? id : WindowIdentifier())); -} - -void -CancelVibrate(nsPIDOMWindowInner* window) -{ - CancelVibrate(WindowIdentifier(window)); -} - -void -CancelVibrate(const WindowIdentifier &id) -{ - AssertMainThread(); - - // Although only active windows may start vibrations, a window may - // cancel its own vibration even if it's no longer active. - // - // After a window is marked as inactive, it sends a CancelVibrate - // request. We want this request to cancel a playing vibration - // started by that window, so we certainly don't want to reject the - // cancellation request because the window is now inactive. - // - // But it could be the case that, after this window became inactive, - // some other window came along and started a vibration. We don't - // want this window's cancellation request to cancel that window's - // actively-playing vibration! - // - // To solve this problem, we keep track of the id of the last window - // to start a vibration, and only accepts cancellation requests from - // the same window. All other cancellation requests are ignored. - - if (InSandbox() || (gLastIDToVibrate && *gLastIDToVibrate == id.AsArray())) { - // Don't forward our ID if we are not in the sandbox, because hal_impl - // doesn't need it, and we don't want it to be tempted to read it. The - // empty identifier will assert if it's used. - PROXY_IF_SANDBOXED(CancelVibrate(InSandbox() ? id : WindowIdentifier())); - } -} - template <class InfoType> class ObserversManager { |