Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/dom/GamepadMonitoring.h"
8 : #include "mozilla/dom/GamepadPlatformService.h"
9 : #include "mozilla/ipc/BackgroundParent.h"
10 :
11 : using namespace mozilla::ipc;
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : void
17 0 : MaybeStopGamepadMonitoring()
18 : {
19 0 : AssertIsOnBackgroundThread();
20 : RefPtr<GamepadPlatformService> service =
21 0 : GamepadPlatformService::GetParentService();
22 0 : MOZ_ASSERT(service);
23 0 : if(service->HasGamepadListeners()) {
24 0 : return;
25 : }
26 0 : StopGamepadMonitoring();
27 0 : service->ResetGamepadIndexes();
28 0 : service->MaybeShutdown();
29 : }
30 :
31 : } // namespace dom
32 : } // namespace mozilla
|