Bug 1482753 - Move network/Types.h into hal/ and NetworkObserver into hal namespace. r=gsvelto
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 13 Aug 2018 10:57:50 +0900
changeset 479497 0f7c6b1dae394d5da62b4fade193bca1bb8115af
parent 479496 784bc6605eebd2bb1ba447a1f58a81ad6acbf688
child 479498 586c439c9a0d86b4fd5d734ec31146631fc8374d
push id220
push userfmarier@mozilla.com
push dateMon, 13 Aug 2018 20:22:19 +0000
reviewersgsvelto
bugs1482753
milestone63.0a1
Bug 1482753 - Move network/Types.h into hal/ and NetworkObserver into hal namespace. r=gsvelto Differential Revision: https://phabricator.services.mozilla.com/D3179
dom/network/ConnectionMainThread.h
dom/network/ConnectionWorker.cpp
dom/network/ConnectionWorker.h
dom/network/Types.h
dom/network/moz.build
hal/Hal.h
hal/HalNetworkInformation.h
hal/moz.build
hal/sandbox/SandboxHal.cpp
--- a/dom/network/ConnectionMainThread.h
+++ b/dom/network/ConnectionMainThread.h
@@ -3,25 +3,25 @@
 /* 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_network_ConnectionMainThread_h
 #define mozilla_dom_network_ConnectionMainThread_h
 
 #include "Connection.h"
+#include "mozilla/Hal.h"
 #include "mozilla/Observer.h"
-#include "Types.h"
 
 namespace mozilla {
 namespace dom {
 namespace network {
 
 class ConnectionMainThread final : public Connection
-                                 , public NetworkObserver
+                                 , public hal::NetworkObserver
 {
 public:
   explicit ConnectionMainThread(nsPIDOMWindowInner* aWindow);
 
   // For IObserver
   void Notify(const hal::NetworkInformation& aNetworkInfo) override;
 
 private:
--- a/dom/network/ConnectionWorker.cpp
+++ b/dom/network/ConnectionWorker.cpp
@@ -9,17 +9,17 @@
 #include "ConnectionWorker.h"
 #include "mozilla/dom/WorkerRef.h"
 #include "mozilla/dom/WorkerRunnable.h"
 
 namespace mozilla {
 namespace dom {
 namespace network {
 
-class ConnectionProxy final : public NetworkObserver
+class ConnectionProxy final : public hal::NetworkObserver
 {
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ConnectionProxy)
 
   static already_AddRefed<ConnectionProxy>
   Create(WorkerPrivate* aWorkerPrivate, ConnectionWorker* aConnection)
   {
     RefPtr<ConnectionProxy> proxy = new ConnectionProxy(aConnection);
--- a/dom/network/ConnectionWorker.h
+++ b/dom/network/ConnectionWorker.h
@@ -3,18 +3,16 @@
 /* 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_network_ConnectionWorker_h
 #define mozilla_dom_network_ConnectionWorker_h
 
 #include "Connection.h"
-#include "mozilla/Observer.h"
-#include "Types.h"
 
 namespace mozilla {
 namespace dom {
 namespace network {
 
 class ConnectionProxy;
 
 class ConnectionWorker final : public Connection
--- a/dom/network/moz.build
+++ b/dom/network/moz.build
@@ -20,17 +20,16 @@ EXPORTS.mozilla.dom += [
 
 EXPORTS.mozilla.dom.network += [
     'Connection.h',
     'Constants.h',
     'TCPServerSocketChild.h',
     'TCPServerSocketParent.h',
     'TCPSocketChild.h',
     'TCPSocketParent.h',
-    'Types.h',
     'UDPSocketChild.h',
     'UDPSocketParent.h',
 ]
 
 UNIFIED_SOURCES += [
     'Connection.cpp',
     'ConnectionMainThread.cpp',
     'ConnectionWorker.cpp',
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -6,20 +6,20 @@
 
 #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/network/Types.h"
 #include "mozilla/dom/power/Types.h"
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/hal_sandbox/PHal.h"
+#include "mozilla/HalNetworkInformation.h"
 #include "mozilla/HalScreenConfiguration.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
@@ -142,23 +142,23 @@ void EnableSensorNotifications(hal::Sens
  */
 void DisableSensorNotifications(hal::SensorType aSensor);
 
 
 /**
  * Inform the network backend there is a new network observer.
  * @param aNetworkObserver The observer that should be added.
  */
-void RegisterNetworkObserver(NetworkObserver* aNetworkObserver);
+void RegisterNetworkObserver(hal::NetworkObserver* aNetworkObserver);
 
 /**
  * Inform the network backend a network observer unregistered.
  * @param aNetworkObserver The observer that should be removed.
  */
-void UnregisterNetworkObserver(NetworkObserver* aNetworkObserver);
+void UnregisterNetworkObserver(hal::NetworkObserver* aNetworkObserver);
 
 /**
  * Returns the current network information.
  */
 void GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo);
 
 /**
  * Notify of a change in the network state.
rename from dom/network/Types.h
rename to hal/HalNetworkInformation.h
--- a/dom/network/Types.h
+++ b/hal/HalNetworkInformation.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_network_Types_h
-#define mozilla_dom_network_Types_h
+#ifndef mozilla_HalNetworkInformation_h
+#define mozilla_HalNetworkInformation_h
+
+#include "mozilla/Observer.h"
 
 namespace mozilla {
 namespace hal {
 class NetworkInformation;
+typedef Observer<hal::NetworkInformation> NetworkObserver;
 } // namespace hal
-
-template <class T>
-class Observer;
-
-typedef Observer<hal::NetworkInformation> NetworkObserver;
-
 } // namespace mozilla
 
-#endif // mozilla_dom_network_Types_h
+#endif // mozilla_HalNetworkInformation_h
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -5,16 +5,17 @@
 # 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',
     'HalImpl.h',
+    'HalNetworkInformation.h',
     'HalSandbox.h',
     'HalScreenConfiguration.h',
     'HalSensor.h',
     'HalTypes.h',
     'HalWakeLock.h',
 ]
 
 EXPORTS.mozilla.fallback += [
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -8,17 +8,16 @@
 #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/network/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"