Skip to content

Commit 94effe3

Browse files
committed
Bug 1315896 - Part 2: Remove MOZ_GAMEPAD in Gamepad module; r=ted.mielczarek
MozReview-Commit-ID: Hbv6THaI5Rk --HG-- extra : rebase_source : aa6b247881c45b2d615d5e37576801e91ed77312
1 parent 755ed03 commit 94effe3

12 files changed

+110
-142
lines changed

dom/events/EventListenerManager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,11 @@ EventListenerManager::AddEventListenerInternal(
408408
#endif
409409
window->SetHasMouseEnterLeaveEventListeners();
410410
}
411-
#ifdef MOZ_GAMEPAD
412411
} else if (aEventMessage >= eGamepadEventFirst &&
413412
aEventMessage <= eGamepadEventLast) {
414413
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
415414
window->SetHasGamepadEventListener();
416415
}
417-
#endif
418416
} else if (aTypeAtom == nsGkAtoms::onkeydown ||
419417
aTypeAtom == nsGkAtoms::onkeypress ||
420418
aTypeAtom == nsGkAtoms::onkeyup) {

dom/gamepad/GamepadPlatformService.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ GamepadPlatformService::AddGamepad(const char* aID,
9595

9696
uint32_t index = ++mGamepadIndex;
9797
GamepadAdded a(NS_ConvertUTF8toUTF16(nsDependentCString(aID)), index,
98-
static_cast<uint32_t>(aMapping), static_cast<uint32_t>(GamepadHand::_empty),
99-
GamepadServiceType::Standard, aNumButtons, aNumAxes);
98+
aMapping, GamepadHand::_empty, GamepadServiceType::Standard,
99+
aNumButtons, aNumAxes);
100100
NotifyGamepadChange<GamepadAdded>(a);
101101
return index;
102102
}

dom/gamepad/GamepadServiceTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ GamepadServiceTest::DestroyPBackgroundActor()
113113

114114
already_AddRefed<Promise>
115115
GamepadServiceTest::AddGamepad(const nsAString& aID,
116-
uint32_t aMapping,
116+
GamepadMappingType aMapping,
117117
uint32_t aNumButtons,
118118
uint32_t aNumAxes,
119119
ErrorResult& aRv)
@@ -123,7 +123,7 @@ GamepadServiceTest::AddGamepad(const nsAString& aID,
123123
}
124124

125125
GamepadAdded a(nsString(aID), 0,
126-
aMapping, static_cast<uint32_t>(GamepadHand::_empty),
126+
aMapping, GamepadHand::_empty,
127127
GamepadServiceType::Standard,
128128
aNumButtons, aNumAxes);
129129
GamepadChangeEvent e(a);

dom/gamepad/GamepadServiceTest.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ class GamepadServiceTest final : public DOMEventTargetHelper,
2929
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(GamepadServiceTest,
3030
DOMEventTargetHelper)
3131

32-
uint32_t NoMapping() const { return 0; }
33-
uint32_t StandardMapping() const { return 1; }
32+
GamepadMappingType NoMapping() const { return GamepadMappingType::_empty; }
33+
GamepadMappingType StandardMapping() const { return GamepadMappingType::Standard; }
3434

3535
already_AddRefed<Promise> AddGamepad(const nsAString& aID,
36-
uint32_t aMapping,
36+
GamepadMappingType aMapping,
3737
uint32_t aNumButtons,
3838
uint32_t aNumAxes,
3939
ErrorResult& aRv);

dom/gamepad/ipc/GamepadEventTypes.ipdlh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
using mozilla::dom::GamepadServiceType from "mozilla/dom/GamepadMessageUtils.h";
66
using mozilla::dom::GamepadPoseState from "mozilla/dom/GamepadMessageUtils.h";
7+
using mozilla::dom::GamepadMappingType from "mozilla/dom/GamepadMessageUtils.h";
8+
using mozilla::dom::GamepadHand from "mozilla/dom/GamepadMessageUtils.h";
79

810

911
namespace mozilla {
@@ -12,14 +14,8 @@ namespace dom {
1214
struct GamepadAdded {
1315
nsString id;
1416
uint32_t index;
15-
// Ideally, mapping should be a GamepadMappingType
16-
// But, we have dependency problems in non MOZ_GAMEPAD
17-
// platforms. Therefore, we make it as an uint32_t here.
18-
uint32_t mapping;
19-
// Ideally, hand should be a GamepadHand
20-
// But, we have dependency problems in non MOZ_GAMEPAD
21-
// platforms. Therefore, we make it as an uint32_t here.
22-
uint32_t hand;
17+
GamepadMappingType mapping;
18+
GamepadHand hand;
2319
GamepadServiceType service_type;
2420
uint32_t num_buttons;
2521
uint32_t num_axes;

dom/gamepad/ipc/GamepadMessageUtils.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,26 @@
33
#define mozilla_dom_gamepad_GamepadMessageUtils_h
44

55
#include "ipc/IPCMessageUtils.h"
6-
#include "mozilla/dom/GamepadServiceType.h"
6+
#include "mozilla/dom/GamepadBinding.h"
77
#include "mozilla/dom/GamepadPoseState.h"
8+
#include "mozilla/dom/GamepadServiceType.h"
89

910
namespace IPC {
1011

12+
template<>
13+
struct ParamTraits<mozilla::dom::GamepadMappingType> :
14+
public ContiguousEnumSerializer<mozilla::dom::GamepadMappingType,
15+
mozilla::dom::GamepadMappingType(0),
16+
mozilla::dom::GamepadMappingType(
17+
mozilla::dom::GamepadMappingType::EndGuard_)> {};
18+
19+
template<>
20+
struct ParamTraits<mozilla::dom::GamepadHand> :
21+
public ContiguousEnumSerializer<mozilla::dom::GamepadHand,
22+
mozilla::dom::GamepadHand(0),
23+
mozilla::dom::GamepadHand(
24+
mozilla::dom::GamepadHand::EndGuard_)> {};
25+
1126
template<>
1227
struct ParamTraits<mozilla::dom::GamepadServiceType> :
1328
public ContiguousEnumSerializer<mozilla::dom::GamepadServiceType,

dom/gamepad/moz.build

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,69 @@ IPDL_SOURCES += [
1111
]
1212

1313
EXPORTS.mozilla.dom += [
14+
'Gamepad.h',
15+
'GamepadButton.h',
16+
'GamepadManager.h',
17+
'GamepadMonitoring.h',
18+
'GamepadPlatformService.h',
19+
'GamepadPose.h',
1420
'GamepadPoseState.h',
21+
'GamepadServiceTest.h',
22+
'ipc/GamepadEventChannelChild.h',
23+
'ipc/GamepadEventChannelParent.h',
1524
'ipc/GamepadMessageUtils.h',
16-
'ipc/GamepadServiceType.h'
25+
'ipc/GamepadServiceType.h',
26+
'ipc/GamepadTestChannelChild.h',
27+
'ipc/GamepadTestChannelParent.h'
1728
]
1829

19-
if CONFIG['MOZ_GAMEPAD']:
20-
EXPORTS.mozilla.dom += [
21-
'Gamepad.h',
22-
'GamepadButton.h',
23-
'GamepadManager.h',
24-
'GamepadMonitoring.h',
25-
'GamepadPlatformService.h',
26-
'GamepadPose.h',
27-
'GamepadServiceTest.h',
28-
'ipc/GamepadEventChannelChild.h',
29-
'ipc/GamepadEventChannelParent.h',
30-
'ipc/GamepadTestChannelChild.h',
31-
'ipc/GamepadTestChannelParent.h'
32-
]
33-
34-
UNIFIED_SOURCES = [
35-
'Gamepad.cpp',
36-
'GamepadButton.cpp',
37-
'GamepadManager.cpp',
38-
'GamepadMonitoring.cpp',
39-
'GamepadPlatformService.cpp',
40-
'GamepadPose.cpp',
41-
'GamepadServiceTest.cpp',
42-
'ipc/GamepadEventChannelChild.cpp',
43-
'ipc/GamepadEventChannelParent.cpp',
44-
'ipc/GamepadTestChannelChild.cpp',
45-
'ipc/GamepadTestChannelParent.cpp'
46-
]
47-
48-
if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
49-
UNIFIED_SOURCES += [
50-
'fallback/FallbackGamepad.cpp'
51-
]
52-
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
53-
UNIFIED_SOURCES += [
54-
'cocoa/CocoaGamepad.cpp'
55-
]
56-
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
57-
UNIFIED_SOURCES += [
58-
'windows/WindowsGamepad.cpp'
59-
]
60-
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
61-
UNIFIED_SOURCES += [
62-
'linux/LinuxGamepad.cpp'
63-
]
64-
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
65-
UNIFIED_SOURCES += [
66-
'android/AndroidGamepad.cpp'
67-
]
30+
UNIFIED_SOURCES = [
31+
'Gamepad.cpp',
32+
'GamepadButton.cpp',
33+
'GamepadManager.cpp',
34+
'GamepadMonitoring.cpp',
35+
'GamepadPlatformService.cpp',
36+
'GamepadPose.cpp',
37+
'GamepadServiceTest.cpp',
38+
'ipc/GamepadEventChannelChild.cpp',
39+
'ipc/GamepadEventChannelParent.cpp',
40+
'ipc/GamepadTestChannelChild.cpp',
41+
'ipc/GamepadTestChannelParent.cpp'
42+
]
6843

69-
LOCAL_INCLUDES += [
70-
'ipc',
44+
if CONFIG['MOZ_GAMEPAD_BACKEND'] == 'stub':
45+
UNIFIED_SOURCES += [
46+
'fallback/FallbackGamepad.cpp'
47+
]
48+
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'cocoa':
49+
UNIFIED_SOURCES += [
50+
'cocoa/CocoaGamepad.cpp'
51+
]
52+
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'windows':
53+
UNIFIED_SOURCES += [
54+
'windows/WindowsGamepad.cpp'
55+
]
56+
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'linux':
57+
UNIFIED_SOURCES += [
58+
'linux/LinuxGamepad.cpp'
59+
]
60+
elif CONFIG['MOZ_GAMEPAD_BACKEND'] == 'android':
61+
UNIFIED_SOURCES += [
62+
'android/AndroidGamepad.cpp'
7163
]
7264

73-
include('/ipc/chromium/chromium-config.mozbuild')
65+
LOCAL_INCLUDES += [
66+
'ipc',
67+
]
7468

75-
FINAL_LIBRARY = 'xul'
76-
LOCAL_INCLUDES += [
77-
'/dom/base',
78-
]
69+
include('/ipc/chromium/chromium-config.mozbuild')
70+
71+
FINAL_LIBRARY = 'xul'
72+
LOCAL_INCLUDES += [
73+
'/dom/base',
74+
]
7975

80-
CFLAGS += CONFIG['GLIB_CFLAGS']
81-
CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
82-
CXXFLAGS += CONFIG['GLIB_CFLAGS']
83-
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
76+
CFLAGS += CONFIG['GLIB_CFLAGS']
77+
CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
78+
CXXFLAGS += CONFIG['GLIB_CFLAGS']
79+
CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']

dom/tests/moz.build

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ MOCHITEST_MANIFESTS += [
1818
'mochitest/dom-level2-core/mochitest.ini',
1919
'mochitest/dom-level2-html/mochitest.ini',
2020
'mochitest/fetch/mochitest.ini',
21+
'mochitest/gamepad/mochitest.ini',
2122
'mochitest/general/mochitest.ini',
2223
'mochitest/geolocation/mochitest.ini',
2324
'mochitest/localstorage/mochitest.ini',
@@ -41,11 +42,6 @@ MOCHITEST_CHROME_MANIFESTS += [
4142
'mochitest/whatwg/chrome.ini',
4243
]
4344

44-
if CONFIG['MOZ_GAMEPAD']:
45-
MOCHITEST_MANIFESTS += [
46-
'mochitest/gamepad/mochitest.ini',
47-
]
48-
4945
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
5046
BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
5147

hal/moz.build

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ include('/ipc/chromium/chromium-config.mozbuild')
164164

165165
FINAL_LIBRARY = 'xul'
166166

167-
if CONFIG['MOZ_GAMEPAD']:
168-
LOCAL_INCLUDES += [
169-
'/dom/base',
170-
]
167+
LOCAL_INCLUDES += [
168+
'/dom/base',
169+
]
171170

172171
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
173172
# So that we can call nsScreenManagerGonk::GetConfiguration().

ipc/glue/BackgroundChildImpl.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
2525
#include "mozilla/dom/ipc/BlobChild.h"
2626
#include "mozilla/dom/quota/PQuotaChild.h"
27-
#ifdef MOZ_GAMEPAD
2827
#include "mozilla/dom/GamepadEventChannelChild.h"
2928
#include "mozilla/dom/GamepadTestChannelChild.h"
30-
#endif
3129
#include "mozilla/dom/MessagePortChild.h"
3230
#include "mozilla/ipc/PBackgroundTestChild.h"
3331
#include "mozilla/ipc/PSendStreamChild.h"
@@ -481,29 +479,23 @@ BackgroundChildImpl::AllocPGamepadEventChannelChild()
481479
bool
482480
BackgroundChildImpl::DeallocPGamepadEventChannelChild(PGamepadEventChannelChild* aActor)
483481
{
484-
#ifdef MOZ_GAMEPAD
485482
MOZ_ASSERT(aActor);
486483
delete static_cast<dom::GamepadEventChannelChild*>(aActor);
487-
#endif
488484
return true;
489485
}
490486

491487
dom::PGamepadTestChannelChild*
492488
BackgroundChildImpl::AllocPGamepadTestChannelChild()
493489
{
494-
#ifdef MOZ_GAMEPAD
495490
MOZ_CRASH("PGamepadTestChannelChild actor should be manually constructed!");
496-
#endif
497491
return nullptr;
498492
}
499493

500494
bool
501495
BackgroundChildImpl::DeallocPGamepadTestChannelChild(PGamepadTestChannelChild* aActor)
502496
{
503-
#ifdef MOZ_GAMEPAD
504497
MOZ_ASSERT(aActor);
505498
delete static_cast<dom::GamepadTestChannelChild*>(aActor);
506-
#endif
507499
return true;
508500
}
509501

ipc/glue/BackgroundParentImpl.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
#include "mozilla/dom/DOMTypes.h"
1818
#include "mozilla/dom/FileSystemBase.h"
1919
#include "mozilla/dom/FileSystemRequestParent.h"
20-
#ifdef MOZ_GAMEPAD
2120
#include "mozilla/dom/GamepadEventChannelParent.h"
2221
#include "mozilla/dom/GamepadTestChannelParent.h"
23-
#endif
2422
#include "mozilla/dom/PBlobParent.h"
2523
#include "mozilla/dom/PGamepadEventChannelParent.h"
2624
#include "mozilla/dom/PGamepadTestChannelParent.h"
@@ -906,48 +904,36 @@ BackgroundParentImpl::DeallocPFileSystemRequestParent(
906904
dom::PGamepadEventChannelParent*
907905
BackgroundParentImpl::AllocPGamepadEventChannelParent()
908906
{
909-
#ifdef MOZ_GAMEPAD
910907
RefPtr<dom::GamepadEventChannelParent> parent =
911908
new dom::GamepadEventChannelParent();
912909

913910
return parent.forget().take();
914-
#else
915-
return nullptr;
916-
#endif
917911
}
918912

919913
bool
920914
BackgroundParentImpl::DeallocPGamepadEventChannelParent(dom::PGamepadEventChannelParent *aActor)
921915
{
922-
#ifdef MOZ_GAMEPAD
923916
MOZ_ASSERT(aActor);
924917
RefPtr<dom::GamepadEventChannelParent> parent =
925918
dont_AddRef(static_cast<dom::GamepadEventChannelParent*>(aActor));
926-
#endif
927919
return true;
928920
}
929921

930922
dom::PGamepadTestChannelParent*
931923
BackgroundParentImpl::AllocPGamepadTestChannelParent()
932924
{
933-
#ifdef MOZ_GAMEPAD
934925
RefPtr<dom::GamepadTestChannelParent> parent =
935926
new dom::GamepadTestChannelParent();
936927

937928
return parent.forget().take();
938-
#else
939-
return nullptr;
940-
#endif
941929
}
942930

943931
bool
944932
BackgroundParentImpl::DeallocPGamepadTestChannelParent(dom::PGamepadTestChannelParent *aActor)
945933
{
946-
#ifdef MOZ_GAMEPAD
947934
MOZ_ASSERT(aActor);
948935
RefPtr<dom::GamepadTestChannelParent> parent =
949936
dont_AddRef(static_cast<dom::GamepadTestChannelParent*>(aActor));
950-
#endif
951937
return true;
952938
}
953939

0 commit comments

Comments
 (0)