Bug 1482753 - Move battery/Types.h into hal/ and BatteryObserver into hal namespace. r=gsvelto
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 13 Aug 2018 10:57:50 +0900
changeset 431206 586c439c9a0d86b4fd5d734ec31146631fc8374d
parent 431205 0f7c6b1dae394d5da62b4fade193bca1bb8115af
child 431207 8741c8f1eaa615a12d50db8d62a21eb2dbecd585
push id106385
push userhikezoe@mozilla.com
push dateMon, 13 Aug 2018 11:59:52 +0000
treeherdermozilla-inbound@c9c1a36c4f41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgsvelto
bugs1482753
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482753 - Move battery/Types.h into hal/ and BatteryObserver into hal namespace. r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D3180
dom/battery/BatteryManager.h
dom/battery/Types.h
dom/battery/moz.build
dom/quota/QuotaManagerService.h
hal/Hal.h
hal/HalBatteryInformation.h
hal/moz.build
hal/sandbox/SandboxHal.cpp
--- a/dom/battery/BatteryManager.h
+++ b/dom/battery/BatteryManager.h
@@ -2,32 +2,31 @@
 /* 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_battery_BatteryManager_h
 #define mozilla_dom_battery_BatteryManager_h
 
-#include "Types.h"
 #include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/Observer.h"
+#include "mozilla/HalBatteryInformation.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 
 namespace hal {
 class BatteryInformation;
 } // namespace hal
 
 namespace dom {
 namespace battery {
 
 class BatteryManager : public DOMEventTargetHelper
-                     , public BatteryObserver
+                     , public hal::BatteryObserver
 {
 public:
   explicit BatteryManager(nsPIDOMWindowInner* aWindow);
 
   void Init();
   void Shutdown();
 
   // For IObserver.
--- a/dom/battery/moz.build
+++ b/dom/battery/moz.build
@@ -4,17 +4,16 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: Device Interfaces")
 
 EXPORTS.mozilla.dom.battery += [
     'Constants.h',
-    'Types.h',
 ]
 
 SOURCES += [
     'BatteryManager.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
--- a/dom/quota/QuotaManagerService.h
+++ b/dom/quota/QuotaManagerService.h
@@ -3,18 +3,17 @@
 /* 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_quota_QuotaManagerService_h
 #define mozilla_dom_quota_QuotaManagerService_h
 
 #include "mozilla/dom/ipc/IdType.h"
-#include "mozilla/dom/battery/Types.h"
-#include "mozilla/Observer.h"
+#include "mozilla/HalBatteryInformation.h"
 #include "nsAutoPtr.h"
 #include "nsIObserver.h"
 #include "nsIQuotaManagerService.h"
 
 #define QUOTAMANAGER_SERVICE_CONTRACTID \
   "@mozilla.org/dom/quota-manager-service;1"
 
 namespace mozilla {
@@ -32,17 +31,17 @@ namespace dom {
 namespace quota {
 
 class QuotaChild;
 class QuotaManager;
 
 class QuotaManagerService final
   : public nsIQuotaManagerService
   , public nsIObserver
-  , public BatteryObserver
+  , public hal::BatteryObserver
 {
   typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
 
   class BackgroundCreateCallback;
   class PendingRequestInfo;
   class UsageRequestInfo;
   class RequestInfo;
   class IdleMaintenanceInfo;
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -5,20 +5,20 @@
  * 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/battery/Types.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/HalTypes.h"
 #include "mozilla/Types.h"
 
 /*
  * Hal.h contains the public Hal API.
  *
@@ -80,23 +80,23 @@ void Vibrate(const nsTArray<uint32_t>& p
  */
 void CancelVibrate(nsPIDOMWindowInner* aWindow);
 void CancelVibrate(const hal::WindowIdentifier &id);
 
 /**
  * Inform the battery backend there is a new battery observer.
  * @param aBatteryObserver The observer that should be added.
  */
-void RegisterBatteryObserver(BatteryObserver* aBatteryObserver);
+void RegisterBatteryObserver(hal::BatteryObserver* aBatteryObserver);
 
 /**
  * Inform the battery backend a battery observer unregistered.
  * @param aBatteryObserver The observer that should be removed.
  */
-void UnregisterBatteryObserver(BatteryObserver* aBatteryObserver);
+void UnregisterBatteryObserver(hal::BatteryObserver* aBatteryObserver);
 
 /**
  * Returns the current battery information.
  */
 void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
 
 /**
  * Notify of a change in the battery state.
rename from dom/battery/Types.h
rename to hal/HalBatteryInformation.h
--- a/dom/battery/Types.h
+++ b/hal/HalBatteryInformation.h
@@ -1,23 +1,20 @@
 /* -*- 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_battery_Types_h
-#define mozilla_dom_battery_Types_h
+#ifndef mozilla_HalBatteryInformation_h
+#define mozilla_HalBatteryInformation_h
+
+#include "mozilla/Observer.h"
 
 namespace mozilla {
 namespace hal {
 class BatteryInformation;
+typedef Observer<hal::BatteryInformation> BatteryObserver;
 } // namespace hal
-
-template <class T>
-class Observer;
-
-typedef Observer<hal::BatteryInformation> BatteryObserver;
-
 } // namespace mozilla
 
-#endif // mozilla_dom_battery_Types_h
+#endif // mozilla_HalBatteryInformation_h
 
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -4,16 +4,17 @@
 # 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/.
  
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Hardware Abstraction Layer (HAL)')
 
 EXPORTS.mozilla += [
     'Hal.h',
+    'HalBatteryInformation.h',
     'HalImpl.h',
     'HalNetworkInformation.h',
     'HalSandbox.h',
     'HalScreenConfiguration.h',
     'HalSensor.h',
     'HalTypes.h',
     'HalWakeLock.h',
 ]
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -7,17 +7,16 @@
 #include "Hal.h"
 #include "HalLog.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/hal_sandbox/PHalParent.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/TabChild.h"
-#include "mozilla/dom/battery/Types.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/fallback/FallbackScreenConfiguration.h"
 #include "mozilla/EnumeratedRange.h"
 #include "mozilla/Observer.h"
 #include "mozilla/Unused.h"
 #include "nsAutoPtr.h"
 #include "WindowIdentifier.h"