Bug 1225726 - enable nsDNSServiceDiscovery on OS X. r=mcmanus.

This commit is contained in:
Shih-Chiang Chien 2015-11-18 14:02:31 +08:00
parent 8e972d2c57
commit e7d6917a08
4 changed files with 19 additions and 10 deletions

View File

@ -28,7 +28,7 @@ static const mozilla::Module::ContractIDEntry kPresentationDeviceProviderContrac
};
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 }

View File

@ -10,23 +10,25 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'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',
]
]
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',

View File

@ -4,12 +4,15 @@
* 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 {
@ -18,6 +21,7 @@ namespace {
inline void
StartService()
{
#ifdef MOZ_WIDGET_GONK
char value[PROPERTY_VALUE_MAX] = { '\0' };
property_get("init.svc.mdnsd", value, "");
@ -25,11 +29,13 @@ StartService()
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, "");
@ -37,6 +43,7 @@ StopService()
return;
}
property_set("ctl.stop", "mdnsd");
#endif // MOZ_WIDGET_GONK
}
class ServiceCounter

View File

@ -3,7 +3,7 @@
* 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