Bug 1482753 - Move power/Types.h into hal/ and WakeLockObserver into hal namespace. r=gsvelto
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 13 Aug 2018 10:57:50 +0900
changeset 479499 8741c8f1eaa615a12d50db8d62a21eb2dbecd585
parent 479498 586c439c9a0d86b4fd5d734ec31146631fc8374d
child 479500 c9c1a36c4f414593ba6587b746889e9e4d3ba870
push id220
push userfmarier@mozilla.com
push dateMon, 13 Aug 2018 20:22:19 +0000
reviewersgsvelto
bugs1482753
milestone63.0a1
Bug 1482753 - Move power/Types.h into hal/ and WakeLockObserver into hal namespace. r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D3181
dom/power/PowerManagerService.h
dom/power/Types.h
dom/power/moz.build
hal/Hal.h
hal/HalWakeLockInformation.h
hal/moz.build
--- a/dom/power/PowerManagerService.h
+++ b/dom/power/PowerManagerService.h
@@ -7,31 +7,30 @@
 #define mozilla_dom_power_PowerManagerService_h
 
 #include "nsCOMPtr.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsTArray.h"
 #include "nsIDOMWakeLockListener.h"
 #include "nsIPowerManagerService.h"
-#include "mozilla/Observer.h"
-#include "Types.h"
+#include "mozilla/HalWakeLockInformation.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/dom/WakeLock.h"
 
 namespace mozilla {
 namespace dom {
 
 class ContentParent;
 
 namespace power {
 
 class PowerManagerService
   : public nsIPowerManagerService
-  , public WakeLockObserver
+  , public hal::WakeLockObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPOWERMANAGERSERVICE
 
   PowerManagerService() {}
 
   static already_AddRefed<PowerManagerService> GetInstance();
--- a/dom/power/moz.build
+++ b/dom/power/moz.build
@@ -15,17 +15,16 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'dom_power'
 
 EXPORTS.mozilla.dom += [
     'WakeLock.h',
 ]
 
 EXPORTS.mozilla.dom.power += [
     'PowerManagerService.h',
-    'Types.h',
 ]
 
 UNIFIED_SOURCES += [
     'PowerManagerService.cpp',
     'WakeLock.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -5,22 +5,22 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_Hal_h
 #define mozilla_Hal_h
 
 #include "base/basictypes.h"
 #include "base/platform_thread.h"
 #include "nsTArray.h"
-#include "mozilla/dom/power/Types.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/hal_sandbox/PHal.h"
 #include "mozilla/HalBatteryInformation.h"
 #include "mozilla/HalNetworkInformation.h"
 #include "mozilla/HalScreenConfiguration.h"
+#include "mozilla/HalWakeLockInformation.h"
 #include "mozilla/HalTypes.h"
 #include "mozilla/Types.h"
 
 /*
  * Hal.h contains the public Hal API.
  *
  * By default, this file defines its functions in the hal namespace, but if
  * MOZ_HAL_NAMESPACE is defined, we'll define our functions in that namespace.
@@ -179,23 +179,23 @@ void EnableWakeLockNotifications();
  * This method is only used by WakeLockObserversManager.
  */
 void DisableWakeLockNotifications();
 
 /**
  * Inform the wake lock backend there is a new wake lock observer.
  * @param aWakeLockObserver The observer that should be added.
  */
-void RegisterWakeLockObserver(WakeLockObserver* aObserver);
+void RegisterWakeLockObserver(hal::WakeLockObserver* aObserver);
 
 /**
  * Inform the wake lock backend a wake lock observer unregistered.
  * @param aWakeLockObserver The observer that should be removed.
  */
-void UnregisterWakeLockObserver(WakeLockObserver* aObserver);
+void UnregisterWakeLockObserver(hal::WakeLockObserver* aObserver);
 
 /**
  * Adjust a wake lock's counts on behalf of a given process.
  *
  * In most cases, you shouldn't need to pass the aProcessID argument; the
  * default of CONTENT_PROCESS_ID_UNKNOWN is probably what you want.
  *
  * @param aTopic        lock topic
rename from dom/power/Types.h
rename to hal/HalWakeLockInformation.h
--- a/dom/power/Types.h
+++ b/hal/HalWakeLockInformation.h
@@ -1,22 +1,19 @@
 /* -*- 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/. */
-#ifndef mozilla_dom_power_Types_h
-#define mozilla_dom_power_Types_h
+#ifndef mozilla_HalWakeLockInformation_h
+#define mozilla_HalWakeLockInformation_h
+
+#include "mozilla/Observer.h"
 
 namespace mozilla {
 namespace hal {
 class WakeLockInformation;
+typedef Observer<hal::WakeLockInformation> WakeLockObserver;
 } // namespace hal
-
-template <class T>
-class Observer;
-
-typedef Observer<hal::WakeLockInformation> WakeLockObserver;
-
 } // namespace mozilla
 
-#endif // mozilla_dom_power_Types_h
+#endif // mozilla_HalWakeLockInformation_h
 
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -12,16 +12,17 @@ EXPORTS.mozilla += [
     'HalBatteryInformation.h',
     'HalImpl.h',
     'HalNetworkInformation.h',
     'HalSandbox.h',
     'HalScreenConfiguration.h',
     'HalSensor.h',
     'HalTypes.h',
     'HalWakeLock.h',
+    'HalWakeLockInformation.h',
 ]
 
 EXPORTS.mozilla.fallback += [
     'fallback/FallbackScreenConfiguration.h',
 ]
 
 UNIFIED_SOURCES += [
     'HalWakeLock.cpp',