зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1315896 - Part 2: Remove MOZ_GAMEPAD in Gamepad module; r=ted.mielczarek
MozReview-Commit-ID: Hbv6THaI5Rk --HG-- extra : rebase_source : aa6b247881c45b2d615d5e37576801e91ed77312
This commit is contained in:
Родитель
755ed03e79
Коммит
94effe3091
|
@ -408,13 +408,11 @@ EventListenerManager::AddEventListenerInternal(
|
|||
#endif
|
||||
window->SetHasMouseEnterLeaveEventListeners();
|
||||
}
|
||||
#ifdef MOZ_GAMEPAD
|
||||
} else if (aEventMessage >= eGamepadEventFirst &&
|
||||
aEventMessage <= eGamepadEventLast) {
|
||||
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
|
||||
window->SetHasGamepadEventListener();
|
||||
}
|
||||
#endif
|
||||
} else if (aTypeAtom == nsGkAtoms::onkeydown ||
|
||||
aTypeAtom == nsGkAtoms::onkeypress ||
|
||||
aTypeAtom == nsGkAtoms::onkeyup) {
|
||||
|
|
|
@ -95,8 +95,8 @@ GamepadPlatformService::AddGamepad(const char* aID,
|
|||
|
||||
uint32_t index = ++mGamepadIndex;
|
||||
GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), index,
|
||||
static_cast<uint32_t>(aMapping), static_cast<uint32_t>(GamepadHand::_empty),
|
||||
GamepadServiceType::Standard, aNumButtons, aNumAxes);
|
||||
aMapping, GamepadHand::_empty, GamepadServiceType::Standard,
|
||||
aNumButtons, aNumAxes);
|
||||
NotifyGamepadChange<GamepadAdded>(a);
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ GamepadServiceTest::DestroyPBackgroundActor()
|
|||
|
||||
already_AddRefed<Promise>
|
||||
GamepadServiceTest::AddGamepad(const nsAString& aID,
|
||||
uint32_t aMapping,
|
||||
GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons,
|
||||
uint32_t aNumAxes,
|
||||
ErrorResult& aRv)
|
||||
|
@ -123,7 +123,7 @@ GamepadServiceTest::AddGamepad(const nsAString& aID,
|
|||
}
|
||||
|
||||
GamepadAdded a(nsString(aID), 0,
|
||||
aMapping, static_cast<uint32_t>(GamepadHand::_empty),
|
||||
aMapping, GamepadHand::_empty,
|
||||
GamepadServiceType::Standard,
|
||||
aNumButtons, aNumAxes);
|
||||
GamepadChangeEvent e(a);
|
||||
|
|
|
@ -29,11 +29,11 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GamepadServiceTest,
|
||||
DOMEventTargetHelper)
|
||||
|
||||
uint32_t NoMapping() const { return 0; }
|
||||
uint32_t StandardMapping() const { return 1; }
|
||||
GamepadMappingType NoMapping() const { return GamepadMappingType::_empty; }
|
||||
GamepadMappingType StandardMapping() const { return GamepadMappingType::Standard; }
|
||||
|
||||
already_AddRefed<Promise> AddGamepad(const nsAString& aID,
|
||||
uint32_t aMapping,
|
||||
GamepadMappingType aMapping,
|
||||
uint32_t aNumButtons,
|
||||
uint32_t aNumAxes,
|
||||
ErrorResult& aRv);
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
using mozilla::dom::GamepadServiceType from "mozilla/dom/GamepadMessageUtils.h";
|
||||
using mozilla::dom::GamepadPoseState from "mozilla/dom/GamepadMessageUtils.h";
|
||||
using mozilla::dom::GamepadMappingType from "mozilla/dom/GamepadMessageUtils.h";
|
||||
using mozilla::dom::GamepadHand from "mozilla/dom/GamepadMessageUtils.h";
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -12,14 +14,8 @@ namespace dom {
|
|||
struct GamepadAdded {
|
||||
nsString id;
|
||||
uint32_t index;
|
||||
// Ideally, mapping should be a GamepadMappingType
|
||||
// But, we have dependency problems in non MOZ_GAMEPAD
|
||||
// platforms. Therefore, we make it as an uint32_t here.
|
||||
uint32_t mapping;
|
||||
// Ideally, hand should be a GamepadHand
|
||||
// But, we have dependency problems in non MOZ_GAMEPAD
|
||||
// platforms. Therefore, we make it as an uint32_t here.
|
||||
uint32_t hand;
|
||||
GamepadMappingType mapping;
|
||||
GamepadHand hand;
|
||||
GamepadServiceType service_type;
|
||||
uint32_t num_buttons;
|
||||
uint32_t num_axes;
|
||||
|
|
|
@ -3,11 +3,26 @@
|
|||
#define mozilla_dom_gamepad_GamepadMessageUtils_h
|
||||
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/dom/GamepadServiceType.h"
|
||||
#include "mozilla/dom/GamepadBinding.h"
|
||||
#include "mozilla/dom/GamepadPoseState.h"
|
||||
#include "mozilla/dom/GamepadServiceType.h"
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::GamepadMappingType> :
|
||||
public ContiguousEnumSerializer<mozilla::dom::GamepadMappingType,
|
||||
mozilla::dom::GamepadMappingType(0),
|
||||
mozilla::dom::GamepadMappingType(
|
||||
mozilla::dom::GamepadMappingType::EndGuard_)> {};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::GamepadHand> :
|
||||
public ContiguousEnumSerializer<mozilla::dom::GamepadHand,
|
||||
mozilla::dom::GamepadHand(0),
|
||||
mozilla::dom::GamepadHand(
|
||||
mozilla::dom::GamepadHand::EndGuard_)> {};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::GamepadServiceType> :
|
||||
public ContiguousEnumSerializer<mozilla::dom::GamepadServiceType,
|
||||
|
|
|
@ -11,73 +11,69 @@ IPDL_SOURCES += [
|
|||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Gamepad.h',
|
||||
'GamepadButton.h',
|
||||
'GamepadManager.h',
|
||||
'GamepadMonitoring.h',
|
||||
'GamepadPlatformService.h',
|
||||
'GamepadPose.h',
|
||||
'GamepadPoseState.h',
|
||||
'GamepadServiceTest.h',
|
||||
'ipc/GamepadEventChannelChild.h',
|
||||
'ipc/GamepadEventChannelParent.h',
|
||||
'ipc/GamepadMessageUtils.h',
|
||||
'ipc/GamepadServiceType.h'
|
||||
'ipc/GamepadServiceType.h',
|
||||
'ipc/GamepadTestChannelChild.h',
|
||||
'ipc/GamepadTestChannelParent.h'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_GAMEPAD']:
|
||||
EXPORTS.mozilla.dom += [
|
||||
'Gamepad.h',
|
||||
'GamepadButton.h',
|
||||
'GamepadManager.h',
|
||||
'GamepadMonitoring.h',
|
||||
'GamepadPlatformService.h',
|
||||
'GamepadPose.h',
|
||||
'GamepadServiceTest.h',
|
||||
'ipc/GamepadEventChannelChild.h',
|
||||
'ipc/GamepadEventChannelParent.h',
|
||||
'ipc/GamepadTestChannelChild.h',
|
||||
'ipc/GamepadTestChannelParent.h'
|
||||
]
|
||||
UNIFIED_SOURCES = [
|
||||
'Gamepad.cpp',
|
||||
'GamepadButton.cpp',
|
||||
'GamepadManager.cpp',
|
||||
'GamepadMonitoring.cpp',
|
||||
'GamepadPlatformService.cpp',
|
||||
'GamepadPose.cpp',
|
||||
'GamepadServiceTest.cpp',
|
||||
'ipc/GamepadEventChannelChild.cpp',
|
||||
'ipc/GamepadEventChannelParent.cpp',
|
||||
'ipc/GamepadTestChannelChild.cpp',
|
||||
'ipc/GamepadTestChannelParent.cpp'
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES = [
|
||||
'Gamepad.cpp',
|
||||
'GamepadButton.cpp',
|
||||
'GamepadManager.cpp',
|
||||
'GamepadMonitoring.cpp',
|
||||
'GamepadPlatformService.cpp',
|
||||
'GamepadPose.cpp',
|
||||
'GamepadServiceTest.cpp',
|
||||
'ipc/GamepadEventChannelChild.cpp',
|
||||
'ipc/GamepadEventChannelParent.cpp',
|
||||
'ipc/GamepadTestChannelChild.cpp',
|
||||
'ipc/GamepadTestChannelParent.cpp'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
|
||||
UNIFIED_SOURCES += [
|
||||
'fallback/FallbackGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
|
||||
UNIFIED_SOURCES += [
|
||||
'cocoa/CocoaGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
|
||||
UNIFIED_SOURCES += [
|
||||
'windows/WindowsGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
|
||||
UNIFIED_SOURCES += [
|
||||
'linux/LinuxGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
|
||||
UNIFIED_SOURCES += [
|
||||
'android/AndroidGamepad.cpp'
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'ipc',
|
||||
if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
|
||||
UNIFIED_SOURCES += [
|
||||
'fallback/FallbackGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
|
||||
UNIFIED_SOURCES += [
|
||||
'cocoa/CocoaGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
|
||||
UNIFIED_SOURCES += [
|
||||
'windows/WindowsGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
|
||||
UNIFIED_SOURCES += [
|
||||
'linux/LinuxGamepad.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
|
||||
UNIFIED_SOURCES += [
|
||||
'android/AndroidGamepad.cpp'
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
LOCAL_INCLUDES += [
|
||||
'ipc',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
]
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
CFLAGS += CONFIG['GLIB_CFLAGS']
|
||||
CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
CXXFLAGS += CONFIG['GLIB_CFLAGS']
|
||||
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
]
|
||||
|
||||
CFLAGS += CONFIG['GLIB_CFLAGS']
|
||||
CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
CXXFLAGS += CONFIG['GLIB_CFLAGS']
|
||||
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
|
|
|
@ -18,6 +18,7 @@ MOCHITEST_MANIFESTS += [
|
|||
'mochitest/dom-level2-core/mochitest.ini',
|
||||
'mochitest/dom-level2-html/mochitest.ini',
|
||||
'mochitest/fetch/mochitest.ini',
|
||||
'mochitest/gamepad/mochitest.ini',
|
||||
'mochitest/general/mochitest.ini',
|
||||
'mochitest/geolocation/mochitest.ini',
|
||||
'mochitest/localstorage/mochitest.ini',
|
||||
|
@ -41,11 +42,6 @@ MOCHITEST_CHROME_MANIFESTS += [
|
|||
'mochitest/whatwg/chrome.ini',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_GAMEPAD']:
|
||||
MOCHITEST_MANIFESTS += [
|
||||
'mochitest/gamepad/mochitest.ini',
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
|
||||
|
||||
|
|
|
@ -164,10 +164,9 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
|||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['MOZ_GAMEPAD']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/base',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
# So that we can call nsScreenManagerGonk::GetConfiguration().
|
||||
|
|
|
@ -24,10 +24,8 @@
|
|||
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/quota/PQuotaChild.h"
|
||||
#ifdef MOZ_GAMEPAD
|
||||
#include "mozilla/dom/GamepadEventChannelChild.h"
|
||||
#include "mozilla/dom/GamepadTestChannelChild.h"
|
||||
#endif
|
||||
#include "mozilla/dom/MessagePortChild.h"
|
||||
#include "mozilla/ipc/PBackgroundTestChild.h"
|
||||
#include "mozilla/ipc/PSendStreamChild.h"
|
||||
|
@ -481,29 +479,23 @@ BackgroundChildImpl::AllocPGamepadEventChannelChild()
|
|||
bool
|
||||
BackgroundChildImpl::DeallocPGamepadEventChannelChild(PGamepadEventChannelChild* aActor)
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
MOZ_ASSERT(aActor);
|
||||
delete static_cast<dom::GamepadEventChannelChild*>(aActor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
dom::PGamepadTestChannelChild*
|
||||
BackgroundChildImpl::AllocPGamepadTestChannelChild()
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
MOZ_CRASH("PGamepadTestChannelChild actor should be manually constructed!");
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundChildImpl::DeallocPGamepadTestChannelChild(PGamepadTestChannelChild* aActor)
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
MOZ_ASSERT(aActor);
|
||||
delete static_cast<dom::GamepadTestChannelChild*>(aActor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
#include "mozilla/dom/DOMTypes.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemRequestParent.h"
|
||||
#ifdef MOZ_GAMEPAD
|
||||
#include "mozilla/dom/GamepadEventChannelParent.h"
|
||||
#include "mozilla/dom/GamepadTestChannelParent.h"
|
||||
#endif
|
||||
#include "mozilla/dom/PBlobParent.h"
|
||||
#include "mozilla/dom/PGamepadEventChannelParent.h"
|
||||
#include "mozilla/dom/PGamepadTestChannelParent.h"
|
||||
|
@ -906,48 +904,36 @@ BackgroundParentImpl::DeallocPFileSystemRequestParent(
|
|||
dom::PGamepadEventChannelParent*
|
||||
BackgroundParentImpl::AllocPGamepadEventChannelParent()
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
RefPtr<dom::GamepadEventChannelParent> parent =
|
||||
new dom::GamepadEventChannelParent();
|
||||
|
||||
return parent.forget().take();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundParentImpl::DeallocPGamepadEventChannelParent(dom::PGamepadEventChannelParent *aActor)
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
MOZ_ASSERT(aActor);
|
||||
RefPtr<dom::GamepadEventChannelParent> parent =
|
||||
dont_AddRef(static_cast<dom::GamepadEventChannelParent*>(aActor));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
dom::PGamepadTestChannelParent*
|
||||
BackgroundParentImpl::AllocPGamepadTestChannelParent()
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
RefPtr<dom::GamepadTestChannelParent> parent =
|
||||
new dom::GamepadTestChannelParent();
|
||||
|
||||
return parent.forget().take();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundParentImpl::DeallocPGamepadTestChannelParent(dom::PGamepadTestChannelParent *aActor)
|
||||
{
|
||||
#ifdef MOZ_GAMEPAD
|
||||
MOZ_ASSERT(aActor);
|
||||
RefPtr<dom::GamepadTestChannelParent> parent =
|
||||
dont_AddRef(static_cast<dom::GamepadTestChannelParent*>(aActor));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -3453,41 +3453,31 @@ fi # COMPILE_ENVIRONMENT
|
|||
dnl ========================================================
|
||||
dnl Gamepad support
|
||||
dnl ========================================================
|
||||
MOZ_GAMEPAD=1
|
||||
MOZ_GAMEPAD_BACKEND=stub
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(gamepad,
|
||||
[ --disable-gamepad Disable gamepad support],
|
||||
MOZ_GAMEPAD=,
|
||||
MOZ_GAMEPAD=1)
|
||||
case "$OS_TARGET" in
|
||||
Darwin)
|
||||
if test -z "$MOZ_IOS"; then
|
||||
MOZ_GAMEPAD_BACKEND=cocoa
|
||||
fi
|
||||
;;
|
||||
WINNT)
|
||||
MOZ_GAMEPAD_BACKEND=windows
|
||||
;;
|
||||
Linux)
|
||||
MOZ_CHECK_HEADER([linux/joystick.h])
|
||||
if test "$ac_cv_header_linux_joystick_h" != "yes"; then
|
||||
AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
|
||||
fi
|
||||
MOZ_GAMEPAD_BACKEND=linux
|
||||
;;
|
||||
Android)
|
||||
MOZ_GAMEPAD_BACKEND=android
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$MOZ_GAMEPAD"; then
|
||||
case "$OS_TARGET" in
|
||||
Darwin)
|
||||
if test -z "$MOZ_IOS"; then
|
||||
MOZ_GAMEPAD_BACKEND=cocoa
|
||||
fi
|
||||
;;
|
||||
WINNT)
|
||||
MOZ_GAMEPAD_BACKEND=windows
|
||||
;;
|
||||
Linux)
|
||||
MOZ_CHECK_HEADER([linux/joystick.h])
|
||||
if test "$ac_cv_header_linux_joystick_h" != "yes"; then
|
||||
AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
|
||||
fi
|
||||
MOZ_GAMEPAD_BACKEND=linux
|
||||
;;
|
||||
Android)
|
||||
MOZ_GAMEPAD_BACKEND=android
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE(MOZ_GAMEPAD)
|
||||
fi
|
||||
AC_SUBST(MOZ_GAMEPAD)
|
||||
AC_SUBST(MOZ_GAMEPAD_BACKEND)
|
||||
|
||||
dnl ========================================================
|
||||
|
|
Загрузка…
Ссылка в новой задаче