Bug 1282993 - Fix build error in Platform which don't support gamepad API. r=baku
authorChih-Yi Leu <cleu@mozilla.com>
Wed, 29 Jun 2016 20:39:00 +0200
changeset 303296 01171389f44a73b06d115343e8920447e0043086
parent 303295 fc5ec3f3844514a328972c97e58dd6d0898c5ab6
child 303297 846095c0236972cb9f095e28e02dd624e8cda58f
push idunknown
push userunknown
push dateunknown
reviewersbaku
bugs1282993
milestone50.0a1
Bug 1282993 - Fix build error in Platform which don't support gamepad API. r=baku
dom/gamepad/moz.build
dom/moz.build
dom/webidl/moz.build
ipc/glue/BackgroundChildImpl.cpp
ipc/glue/BackgroundParentImpl.cpp
--- a/dom/gamepad/moz.build
+++ b/dom/gamepad/moz.build
@@ -1,74 +1,75 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
-EXPORTS.mozilla.dom += [
-    'Gamepad.h',
-    'GamepadButton.h',
-    'GamepadManager.h',
-    'GamepadMonitoring.h',
-    'GamepadPlatformService.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',
-    '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',
-]
-
 IPDL_SOURCES += [
     'ipc/GamepadEventTypes.ipdlh',
     'ipc/PGamepadEventChannel.ipdl',
     'ipc/PGamepadTestChannel.ipdl'
 ]
 
-include('/ipc/chromium/chromium-config.mozbuild')
+if CONFIG['MOZ_GAMEPAD']:
+    EXPORTS.mozilla.dom += [
+        'Gamepad.h',
+        'GamepadButton.h',
+        'GamepadManager.h',
+        'GamepadMonitoring.h',
+        'GamepadPlatformService.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',
+        'GamepadServiceTest.cpp',
+        'ipc/GamepadEventChannelChild.cpp',
+        'ipc/GamepadEventChannelParent.cpp',
+        'ipc/GamepadTestChannelChild.cpp',
+        'ipc/GamepadTestChannelParent.cpp'
+        ]
 
-FINAL_LIBRARY = 'xul'
-LOCAL_INCLUDES += [
-    '/dom/base',
-]
+    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'
+        ]
 
-CFLAGS += CONFIG['GLIB_CFLAGS']
-CFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
-CXXFLAGS += CONFIG['GLIB_CFLAGS']
-CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+    LOCAL_INCLUDES += [
+        'ipc',
+    ]
+
+    include('/ipc/chromium/chromium-config.mozbuild')
+
+    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']
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -56,16 +56,17 @@ DIRS += [
     'devicestorage',
     'encoding',
     'events',
     'fetch',
     'filehandle',
     'filesystem',
     'flyweb',
     'fmradio',
+    'gamepad',
     'geolocation',
     'html',
     'icc',
     'inputport',
     'json',
     'jsurl',
     'asmjscache',
     'mathml',
@@ -130,19 +131,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
 if CONFIG['MOZ_B2G_RIL']:
     DIRS += [
         'wappush',
     ]
 
 if CONFIG['MOZ_PAY']:
     DIRS += ['payment']
 
-if CONFIG['MOZ_GAMEPAD']:
-    DIRS += ['gamepad']
-
 if CONFIG['MOZ_NFC']:
     DIRS += ['nfc']
 
 if CONFIG['MOZ_SIMPLEPUSH']:
     DIRS += ['simplepush']
 else:
     DIRS += ['push']
 
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -167,17 +167,16 @@ WEBIDL_FILES = [
     'FlyWebWebSocketEvent.webidl',
     'FocusEvent.webidl',
     'FontFace.webidl',
     'FontFaceSet.webidl',
     'FontFaceSource.webidl',
     'FormData.webidl',
     'Function.webidl',
     'GainNode.webidl',
-    'GamepadServiceTest.webidl',
     'Geolocation.webidl',
     'GeometryUtils.webidl',
     'GetUserMediaRequest.webidl',
     'HDMIInputPort.webidl',
     'Headers.webidl',
     'HeapSnapshot.webidl',
     'History.webidl',
     'HTMLAllCollection.webidl',
@@ -655,16 +654,17 @@ if CONFIG['MOZ_WEBSPEECH']:
         'SpeechSynthesisEvent.webidl',
         'SpeechSynthesisUtterance.webidl',
         'SpeechSynthesisVoice.webidl',
     ]
 
 if CONFIG['MOZ_GAMEPAD']:
     WEBIDL_FILES += [
         'Gamepad.webidl',
+        'GamepadServiceTest.webidl'
     ]
 
 WEBIDL_FILES += [
     'CloseEvent.webidl',
     'CustomEvent.webidl',
     'DeviceOrientationEvent.webidl',
     'DeviceStorageChangeEvent.webidl',
     'DOMTransactionEvent.webidl',
--- a/ipc/glue/BackgroundChildImpl.cpp
+++ b/ipc/glue/BackgroundChildImpl.cpp
@@ -19,18 +19,20 @@
 #include "mozilla/dom/PFileSystemRequestChild.h"
 #include "mozilla/dom/FileSystemTaskBase.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
 #include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
 #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/dom/NuwaChild.h"
 #include "mozilla/ipc/PBackgroundTestChild.h"
 #include "mozilla/ipc/PSendStreamChild.h"
 #include "mozilla/layout/VsyncChild.h"
 #include "mozilla/net/PUDPSocketChild.h"
 #include "mozilla/dom/network/UDPSocketChild.h"
 #include "nsID.h"
@@ -491,33 +493,39 @@ BackgroundChildImpl::AllocPGamepadEventC
 {
   MOZ_CRASH("PGamepadEventChannelChild actor should be manually constructed!");
   return nullptr;
 }
 
 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;
 }
 
 } // namespace ipc
 } // namespace mozilla
 
 bool
 TestChild::Recv__delete__(const nsCString& aTestArg)
--- a/ipc/glue/BackgroundParentImpl.cpp
+++ b/ipc/glue/BackgroundParentImpl.cpp
@@ -13,18 +13,20 @@
 #endif
 #include "mozilla/media/MediaParent.h"
 #include "mozilla/AppProcessChecker.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/dom/ContentParent.h"
 #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/NuwaParent.h"
 #include "mozilla/dom/PBlobParent.h"
 #include "mozilla/dom/PGamepadEventChannelParent.h"
 #include "mozilla/dom/PGamepadTestChannelParent.h"
 #include "mozilla/dom/MessagePortParent.h"
 #include "mozilla/dom/ServiceWorkerRegistrar.h"
 #include "mozilla/dom/asmjscache/AsmJSCache.h"
 #include "mozilla/dom/cache/ActorUtils.h"
@@ -919,46 +921,58 @@ BackgroundParentImpl::DeallocPFileSystem
     dont_AddRef(static_cast<FileSystemRequestParent*>(aDoomed));
   return true;
 }
 
 // Gamepad API Background IPC
 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;
 }
 
 } // namespace ipc
 } // namespace mozilla
 
 void
 TestParent::ActorDestroy(ActorDestroyReason aWhy)