Bug 1225726 - enable nsDNSServiceDiscovery on OS X. r=mcmanus.
authorShih-Chiang Chien <schien@mozilla.com>
Wed, 18 Nov 2015 14:02:31 +0800
changeset 273853 6bfb430de85d
parent 273852 1dac03558135
child 273854 57f738fb6ab6
push id29715
push userkwierso@gmail.com
push dateTue, 24 Nov 2015 21:54:25 +0000
treeherdermozilla-central@d9243e369c22 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1225726
milestone45.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 1225726 - enable nsDNSServiceDiscovery on OS X. r=mcmanus.
dom/presentation/provider/PresentationDeviceProviderModule.cpp
netwerk/dns/mdns/libmdns/moz.build
netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp
netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
--- a/dom/presentation/provider/PresentationDeviceProviderModule.cpp
+++ b/dom/presentation/provider/PresentationDeviceProviderModule.cpp
@@ -23,17 +23,17 @@ static const mozilla::Module::CIDEntry k
 };
 
 static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContracts[] = {
   { MULTICAST_DNS_PROVIDER_CONTRACT_ID, &kMULTICAST_DNS_PROVIDER_CID },
   { nullptr }
 };
 
 static const mozilla::Module::CategoryEntry kPresentationDeviceProviderCategories[] = {
-#if defined(MOZ_WIDGET_ANDROID) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
+#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
   { PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", MULTICAST_DNS_PROVIDER_CONTRACT_ID },
 #endif
   { nullptr }
 };
 
 static const mozilla::Module kPresentationDeviceProviderModule = {
   mozilla::Module::kVersion,
   kPresentationDeviceProviderCIDs,
--- a/netwerk/dns/mdns/libmdns/moz.build
+++ b/netwerk/dns/mdns/libmdns/moz.build
@@ -5,32 +5,34 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     EXTRA_COMPONENTS += [
         'nsDNSServiceDiscovery.js',
         'nsDNSServiceDiscovery.manifest',
     ]
 
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] >= '16':
+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa' or \
+        (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['ANDROID_VERSION'] >= '16'):
     UNIFIED_SOURCES += [
         'MDNSResponderOperator.cpp',
         'MDNSResponderReply.cpp',
         'nsDNSServiceDiscovery.cpp',
     ]
 
     LOCAL_INCLUDES += [
-        '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
-            'external/mdnsresponder/mDNSShared',
-        ]
+      '/netwerk/base',
     ]
 
-    LOCAL_INCLUDES += [
-      '/netwerk/base',
-    ]
+    if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+        LOCAL_INCLUDES += [
+            '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
+                'external/mdnsresponder/mDNSShared',
+            ]
+        ]
 
 UNIFIED_SOURCES += [
     'nsDNSServiceInfo.cpp',
     'nsMulticastDNSModule.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 FINAL_LIBRARY = 'xul'
--- a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp
+++ b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.cpp
@@ -1,47 +1,54 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsDNSServiceDiscovery.h"
-#include <cutils/properties.h>
 #include "MDNSResponderOperator.h"
 #include "nsICancelable.h"
 #include "nsXULAppAPI.h"
 #include "private/pprio.h"
 
+#ifdef MOZ_WIDGET_GONK
+#include <cutils/properties.h>
+#endif // MOZ_WIDGET_GONK
+
 namespace mozilla {
 namespace net {
 
 namespace {
 
 inline void
 StartService()
 {
+#ifdef MOZ_WIDGET_GONK
   char value[PROPERTY_VALUE_MAX] = { '\0' };
   property_get("init.svc.mdnsd", value, "");
 
   if (strcmp(value, "running") == 0) {
     return;
   }
   property_set("ctl.start", "mdnsd");
+#endif // MOZ_WIDGET_GONK
 }
 
 inline void
 StopService()
 {
+#ifdef MOZ_WIDGET_GONK
   char value[PROPERTY_VALUE_MAX] = { '\0' };
   property_get("init.svc.mdnsd", value, "");
 
   if (strcmp(value, "stopped") == 0) {
     return;
   }
   property_set("ctl.stop", "mdnsd");
+#endif // MOZ_WIDGET_GONK
 }
 
 class ServiceCounter
 {
 public:
   static bool IsServiceRunning()
   {
     return !!sUseCount;
--- a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
+++ b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16
+#if defined(MOZ_WIDGET_COCOA) || (defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 16)
 #define ENABLE_DNS_SERVICE_DISCOVERY
 #endif
 
 #include "mozilla/ModuleUtils.h"
 
 #ifdef ENABLE_DNS_SERVICE_DISCOVERY
 #include "nsDNSServiceDiscovery.h"
 #endif