dom/gamepad/GamepadMonitoring.cpp
author Michael Layzell <michael@thelayzells.com>
Thu, 02 Mar 2017 16:55:09 -0500
changeset 348695 c2b8ead5376b5f5a3689e4faef9d814c27189ab6
parent 302842 8f8875dbdc71478aaf172c2a5c146443f171496d
child 448947 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1337056 - Part 3: Send down http[s] and ftp permissions as they are needed. Send down other permissions at startup, r=baku MozReview-Commit-ID: CUKPvFp6zpF

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "mozilla/dom/GamepadMonitoring.h"
#include "mozilla/dom/GamepadPlatformService.h"
#include "mozilla/ipc/BackgroundParent.h"

using namespace mozilla::ipc;

namespace mozilla {
namespace dom {

void
MaybeStopGamepadMonitoring()
{
  AssertIsOnBackgroundThread();
  RefPtr<GamepadPlatformService> service =
    GamepadPlatformService::GetParentService();
  MOZ_ASSERT(service);
  if(service->HasGamepadListeners()) {
    return;
  }
  StopGamepadMonitoring();
  service->ResetGamepadIndexes();
  service->MaybeShutdown();
}

} // namespace dom
} // namespace mozilla