diff options
author | Moonchild <moonchild@palemoon.org> | 2021-05-03 11:35:41 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-05-03 11:35:41 +0000 |
commit | 1bf0734a7249eb0dc1a96d825e7310eb46cac6dc (patch) | |
tree | 1f941b9822dabf5301601c83b3ac8ab91d8a622e /xpcom/base | |
parent | b1eb04d3f0fde242edb8e9b8b11d00539ceeade7 (diff) | |
download | uxp-1bf0734a7249eb0dc1a96d825e7310eb46cac6dc.tar.gz |
Issue #1751 -- Remove XP_MACOSX conditionals and support files from /xpcom
Diffstat (limited to 'xpcom/base')
-rw-r--r-- | xpcom/base/MacHelpers.h | 17 | ||||
-rw-r--r-- | xpcom/base/MacHelpers.mm | 40 | ||||
-rw-r--r-- | xpcom/base/moz.build | 17 | ||||
-rw-r--r-- | xpcom/base/nsDebugImpl.cpp | 16 | ||||
-rw-r--r-- | xpcom/base/nsIMacUtils.idl | 32 | ||||
-rw-r--r-- | xpcom/base/nsMacUtilsImpl.cpp | 146 | ||||
-rw-r--r-- | xpcom/base/nsMacUtilsImpl.h | 41 | ||||
-rw-r--r-- | xpcom/base/nsMemoryReporterManager.cpp | 166 | ||||
-rw-r--r-- | xpcom/base/nsSystemInfo.cpp | 77 | ||||
-rw-r--r-- | xpcom/base/nsUUIDGenerator.cpp | 18 | ||||
-rw-r--r-- | xpcom/base/nsUUIDGenerator.h | 2 |
11 files changed, 9 insertions, 563 deletions
diff --git a/xpcom/base/MacHelpers.h b/xpcom/base/MacHelpers.h deleted file mode 100644 index 2bff0367ef..0000000000 --- a/xpcom/base/MacHelpers.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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/. */ - -#ifndef mozilla_MacHelpers_h -#define mozilla_MacHelpers_h - -#include "nsString.h" - -namespace mozilla { - -nsresult GetSelectedCityInfo(nsAString& aCountryCode); - -} // namespace mozilla - -#endif diff --git a/xpcom/base/MacHelpers.mm b/xpcom/base/MacHelpers.mm deleted file mode 100644 index e0b5e6c35b..0000000000 --- a/xpcom/base/MacHelpers.mm +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsString.h" -#include "MacHelpers.h" -#include "nsObjCExceptions.h" - -#import <Foundation/Foundation.h> - -namespace mozilla { - -nsresult -GetSelectedCityInfo(nsAString& aCountryCode) -{ - NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - - // Can be replaced with [[NSLocale currentLocale] countryCode] once we build - // with the 10.12 SDK. - id countryCode = [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]; - - if (![countryCode isKindOfClass:[NSString class]]) { - return NS_ERROR_FAILURE; - } - - const char* countryCodeUTF8 = [(NSString*)countryCode UTF8String]; - - if (!countryCodeUTF8) { - return NS_ERROR_FAILURE; - } - - AppendUTF8toUTF16(countryCodeUTF8, aCountryCode); - return NS_OK; - - NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; -} - -} // namespace Mozilla - diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index a59528c576..03a0fa43a7 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -28,17 +28,6 @@ XPIDL_SOURCES += [ 'nsrootidl.idl', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - XPIDL_SOURCES += [ - 'nsIMacUtils.idl', - ] - EXPORTS.mozilla += [ - 'MacHelpers.h', - ] - UNIFIED_SOURCES += [ - 'MacHelpers.mm', - ] - XPIDL_MODULE = 'xpcom_base' EXPORTS += [ @@ -136,11 +125,7 @@ if CONFIG['OS_ARCH'] == 'Linux': 'SystemMemoryReporter.cpp', ] -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - SOURCES += [ - 'nsMacUtilsImpl.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': SOURCES += [ 'nsCrashOnException.cpp', ] diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index c4d4437a9b..fb4831eeda 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -34,7 +34,7 @@ #include "nsString.h" #endif -#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \ +#if defined(__DragonFly__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) #include <stdbool.h> #include <unistd.h> @@ -58,9 +58,7 @@ #define KINFO_PROC struct kinfo_proc #endif -#if defined(XP_MACOSX) -#define KP_FLAGS kp_proc.p_flag -#elif defined(__DragonFly__) +#if defined(__DragonFly__) #define KP_FLAGS kp_flags #elif defined(__FreeBSD__) #define KP_FLAGS ki_flag @@ -164,7 +162,7 @@ nsDebugImpl::GetIsDebuggerAttached(bool* aResult) #if defined(XP_WIN) *aResult = ::IsDebuggerPresent(); -#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \ +#elif defined(__DragonFly__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) // Specify the info we're looking for int mib[] = { @@ -426,8 +424,6 @@ RealBreak() { #if defined(_WIN32) ::DebugBreak(); -#elif defined(XP_MACOSX) - raise(SIGTRAP); #elif defined(__GNUC__) && (defined(__i386__) || defined(__i386) || defined(__x86_64__)) asm("int $3"); #elif defined(__arm__) @@ -511,12 +507,6 @@ Break(const char* aMsg) } RealBreak(); -#elif defined(XP_MACOSX) - /* Note that we put this Mac OS X test above the GNUC/x86 test because the - * GNUC/x86 test is also true on Intel Mac OS X and we want the PPC/x86 - * impls to be the same. - */ - RealBreak(); #elif defined(__GNUC__) && (defined(__i386__) || defined(__i386) || defined(__x86_64__)) RealBreak(); #elif defined(__arm__) diff --git a/xpcom/base/nsIMacUtils.idl b/xpcom/base/nsIMacUtils.idl deleted file mode 100644 index 9a60df47cd..0000000000 --- a/xpcom/base/nsIMacUtils.idl +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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 "nsISupports.idl" - -/** - * nsIMacUtils: Generic globally-available Mac-specific utilities. - */ - -[scriptable, uuid(5E9072D7-FF95-455E-9466-8AF9841A72EC)] -interface nsIMacUtils : nsISupports -{ - /** - * True when the main executable is a fat file supporting at least - * ppc and x86 (universal binary). - */ - readonly attribute boolean isUniversalBinary; - - /** - * Returns a string containing a list of architectures delimited - * by "-". Architecture sets are always in the same order: - * ppc > i386 > ppc64 > x86_64 > (future additions) - */ - readonly attribute AString architecturesInBinary; - - /** - * True when running under binary translation (Rosetta). - */ - readonly attribute boolean isTranslated; -}; diff --git a/xpcom/base/nsMacUtilsImpl.cpp b/xpcom/base/nsMacUtilsImpl.cpp deleted file mode 100644 index eb93cc555e..0000000000 --- a/xpcom/base/nsMacUtilsImpl.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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 "nsMacUtilsImpl.h" - -#include <CoreFoundation/CoreFoundation.h> - -NS_IMPL_ISUPPORTS(nsMacUtilsImpl, nsIMacUtils) - -nsresult -nsMacUtilsImpl::GetArchString(nsAString& aArchString) -{ - if (!mBinaryArchs.IsEmpty()) { - aArchString.Assign(mBinaryArchs); - return NS_OK; - } - - aArchString.Truncate(); - - bool foundPPC = false, - foundX86 = false, - foundPPC64 = false, - foundX86_64 = false; - - CFBundleRef mainBundle = ::CFBundleGetMainBundle(); - if (!mainBundle) { - return NS_ERROR_FAILURE; - } - - CFArrayRef archList = ::CFBundleCopyExecutableArchitectures(mainBundle); - if (!archList) { - return NS_ERROR_FAILURE; - } - - CFIndex archCount = ::CFArrayGetCount(archList); - for (CFIndex i = 0; i < archCount; i++) { - CFNumberRef arch = - static_cast<CFNumberRef>(::CFArrayGetValueAtIndex(archList, i)); - - int archInt = 0; - if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) { - ::CFRelease(archList); - return NS_ERROR_FAILURE; - } - - if (archInt == kCFBundleExecutableArchitecturePPC) { - foundPPC = true; - } else if (archInt == kCFBundleExecutableArchitectureI386) { - foundX86 = true; - } else if (archInt == kCFBundleExecutableArchitecturePPC64) { - foundPPC64 = true; - } else if (archInt == kCFBundleExecutableArchitectureX86_64) { - foundX86_64 = true; - } - } - - ::CFRelease(archList); - - // The order in the string must always be the same so - // don't do this in the loop. - if (foundPPC) { - mBinaryArchs.AppendLiteral("ppc"); - } - - if (foundX86) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("i386"); - } - - if (foundPPC64) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("ppc64"); - } - - if (foundX86_64) { - if (!mBinaryArchs.IsEmpty()) { - mBinaryArchs.Append('-'); - } - mBinaryArchs.AppendLiteral("x86_64"); - } - - aArchString.Assign(mBinaryArchs); - - return (aArchString.IsEmpty() ? NS_ERROR_FAILURE : NS_OK); -} - -NS_IMETHODIMP -nsMacUtilsImpl::GetIsUniversalBinary(bool* aIsUniversalBinary) -{ - if (NS_WARN_IF(!aIsUniversalBinary)) { - return NS_ERROR_INVALID_ARG; - } - *aIsUniversalBinary = false; - - nsAutoString archString; - nsresult rv = GetArchString(archString); - if (NS_FAILED(rv)) { - return rv; - } - - // The delimiter char in the arch string is '-', so if that character - // is in the string we know we have multiple architectures. - *aIsUniversalBinary = (archString.Find("-") > -1); - - return NS_OK; -} - -NS_IMETHODIMP -nsMacUtilsImpl::GetArchitecturesInBinary(nsAString& aArchString) -{ - return GetArchString(aArchString); -} - -// True when running under binary translation (Rosetta). -NS_IMETHODIMP -nsMacUtilsImpl::GetIsTranslated(bool* aIsTranslated) -{ -#ifdef __ppc__ - static bool sInitialized = false; - - // Initialize sIsNative to 1. If the sysctl fails because it doesn't - // exist, then translation is not possible, so the process must not be - // running translated. - static int32_t sIsNative = 1; - - if (!sInitialized) { - size_t sz = sizeof(sIsNative); - sysctlbyname("sysctl.proc_native", &sIsNative, &sz, nullptr, 0); - sInitialized = true; - } - - *aIsTranslated = !sIsNative; -#else - // Translation only exists for ppc code. Other architectures aren't - // translated. - *aIsTranslated = false; -#endif - - return NS_OK; -} diff --git a/xpcom/base/nsMacUtilsImpl.h b/xpcom/base/nsMacUtilsImpl.h deleted file mode 100644 index 12a1add41a..0000000000 --- a/xpcom/base/nsMacUtilsImpl.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; 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/. */ - -#ifndef nsMacUtilsImpl_h___ -#define nsMacUtilsImpl_h___ - -#include "nsIMacUtils.h" -#include "nsString.h" -#include "mozilla/Attributes.h" - -class nsMacUtilsImpl final : public nsIMacUtils -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIMACUTILS - - nsMacUtilsImpl() - { - } - -private: - ~nsMacUtilsImpl() - { - } - - nsresult GetArchString(nsAString& aArchString); - - // A string containing a "-" delimited list of architectures - // in our binary. - nsString mBinaryArchs; -}; - -// Global singleton service -// 697BD3FD-43E5-41CE-AD5E-C339175C0818 -#define NS_MACUTILSIMPL_CID \ - {0x697BD3FD, 0x43E5, 0x41CE, {0xAD, 0x5E, 0xC3, 0x39, 0x17, 0x5C, 0x08, 0x18}} -#define NS_MACUTILSIMPL_CONTRACTID "@mozilla.org/xpcom/mac-utils;1" - -#endif /* nsMacUtilsImpl_h___ */ diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index b17dee4e57..810254bcc6 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -395,168 +395,6 @@ ResidentFastDistinguishedAmount(int64_t* aN) return ResidentDistinguishedAmount(aN); } -#elif defined(XP_MACOSX) - -#include <mach/mach_init.h> -#include <mach/mach_vm.h> -#include <mach/shared_region.h> -#include <mach/task.h> -#include <sys/sysctl.h> - -static MOZ_MUST_USE bool -GetTaskBasicInfo(struct task_basic_info* aTi) -{ - mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT; - kern_return_t kr = task_info(mach_task_self(), TASK_BASIC_INFO, - (task_info_t)aTi, &count); - return kr == KERN_SUCCESS; -} - -// The VSIZE figure on Mac includes huge amounts of shared memory and is always -// absurdly high, eg. 2GB+ even at start-up. But both 'top' and 'ps' report -// it, so we might as well too. -#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static MOZ_MUST_USE nsresult -VsizeDistinguishedAmount(int64_t* aN) -{ - task_basic_info ti; - if (!GetTaskBasicInfo(&ti)) { - return NS_ERROR_FAILURE; - } - *aN = ti.virtual_size; - return NS_OK; -} - -// If we're using jemalloc on Mac, we need to instruct jemalloc to purge the -// pages it has madvise(MADV_FREE)'d before we read our RSS in order to get -// an accurate result. The OS will take away MADV_FREE'd pages when there's -// memory pressure, so ideally, they shouldn't count against our RSS. -// -// Purging these pages can take a long time for some users (see bug 789975), -// so we provide the option to get the RSS without purging first. -static MOZ_MUST_USE nsresult -ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge) -{ -#ifdef HAVE_JEMALLOC_STATS - if (aDoPurge) { - jemalloc_purge_freed_pages(); - } -#endif - - task_basic_info ti; - if (!GetTaskBasicInfo(&ti)) { - return NS_ERROR_FAILURE; - } - *aN = ti.resident_size; - return NS_OK; -} - -static MOZ_MUST_USE nsresult -ResidentFastDistinguishedAmount(int64_t* aN) -{ - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ false); -} - -static MOZ_MUST_USE nsresult -ResidentDistinguishedAmount(int64_t* aN) -{ - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ true); -} - -#define HAVE_RESIDENT_UNIQUE_REPORTER 1 - -static bool -InSharedRegion(mach_vm_address_t aAddr, cpu_type_t aType) -{ - mach_vm_address_t base; - mach_vm_address_t size; - - switch (aType) { - case CPU_TYPE_ARM: - base = SHARED_REGION_BASE_ARM; - size = SHARED_REGION_SIZE_ARM; - break; - case CPU_TYPE_I386: - base = SHARED_REGION_BASE_I386; - size = SHARED_REGION_SIZE_I386; - break; - case CPU_TYPE_X86_64: - base = SHARED_REGION_BASE_X86_64; - size = SHARED_REGION_SIZE_X86_64; - break; - default: - return false; - } - - return base <= aAddr && aAddr < (base + size); -} - -static MOZ_MUST_USE nsresult -ResidentUniqueDistinguishedAmount(int64_t* aN) -{ - if (!aN) { - return NS_ERROR_FAILURE; - } - - cpu_type_t cpu_type; - size_t len = sizeof(cpu_type); - if (sysctlbyname("sysctl.proc_cputype", &cpu_type, &len, NULL, 0) != 0) { - return NS_ERROR_FAILURE; - } - - // Roughly based on libtop_update_vm_regions in - // http://www.opensource.apple.com/source/top/top-100.1.2/libtop.c - size_t privatePages = 0; - mach_vm_size_t size = 0; - for (mach_vm_address_t addr = MACH_VM_MIN_ADDRESS; ; addr += size) { - vm_region_top_info_data_t info; - mach_msg_type_number_t infoCount = VM_REGION_TOP_INFO_COUNT; - mach_port_t objectName; - - kern_return_t kr = - mach_vm_region(mach_task_self(), &addr, &size, VM_REGION_TOP_INFO, - reinterpret_cast<vm_region_info_t>(&info), - &infoCount, &objectName); - if (kr == KERN_INVALID_ADDRESS) { - // Done iterating VM regions. - break; - } else if (kr != KERN_SUCCESS) { - return NS_ERROR_FAILURE; - } - - if (InSharedRegion(addr, cpu_type) && info.share_mode != SM_PRIVATE) { - continue; - } - - switch (info.share_mode) { - case SM_LARGE_PAGE: - // NB: Large pages are not shareable and always resident. - case SM_PRIVATE: - privatePages += info.private_pages_resident; - privatePages += info.shared_pages_resident; - break; - case SM_COW: - privatePages += info.private_pages_resident; - if (info.ref_count == 1) { - // Treat copy-on-write pages as private if they only have one reference. - privatePages += info.shared_pages_resident; - } - break; - case SM_SHARED: - default: - break; - } - } - - vm_size_t pageSize; - if (host_page_size(mach_host_self(), &pageSize) != KERN_SUCCESS) { - pageSize = PAGE_SIZE; - } - - *aN = privatePages * pageSize; - return NS_OK; -} - #elif defined(XP_WIN) #include <windows.h> @@ -1147,9 +985,7 @@ ResidentPeakDistinguishedAmount(int64_t* aN) // - Solaris: pages? But some sources it actually always returns 0, so // check for that // - Linux, {Net/Open/Free}BSD, DragonFly: KiB -#ifdef XP_MACOSX - *aN = usage.ru_maxrss; -#elif defined(XP_SOLARIS) +#if defined(XP_SOLARIS) *aN = usage.ru_maxrss * getpagesize(); #else *aN = usage.ru_maxrss * 1024; diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 4cfc11e9bf..027d36f10d 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -25,10 +25,6 @@ #include "nsWindowsHelpers.h" #endif -#ifdef XP_MACOSX -#include "MacHelpers.h" -#endif - #ifdef MOZ_WIDGET_GTK #include <gtk/gtk.h> #include <dlfcn.h> @@ -44,10 +40,6 @@ #include <string> #endif -#ifdef XP_MACOSX -#include <sys/sysctl.h> -#endif - // Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init. // Only set to nonzero (potentially) if XP_UNIX. On such systems, the // system call to discover the appropriate value is not thread-safe, @@ -418,67 +410,6 @@ nsSystemInfo::Init() cpuFamily = si.wProcessorLevel; cpuModel = si.wProcessorRevision >> 8; cpuStepping = si.wProcessorRevision & 0xFF; -#elif defined (XP_MACOSX) - // CPU speed - uint64_t sysctlValue64 = 0; - uint32_t sysctlValue32 = 0; - size_t len = 0; - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.cpufrequency_max", &sysctlValue64, &len, NULL, 0)) { - cpuSpeed = static_cast<int>(sysctlValue64/1000000); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("hw.physicalcpu_max", &sysctlValue32, &len, NULL, 0)) { - physicalCPUs = static_cast<int>(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("hw.logicalcpu_max", &sysctlValue32, &len, NULL, 0)) { - logicalCPUs = static_cast<int>(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.l2cachesize", &sysctlValue64, &len, NULL, 0)) { - cacheSizeL2 = static_cast<int>(sysctlValue64/1024); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - len = sizeof(sysctlValue64); - if (!sysctlbyname("hw.l3cachesize", &sysctlValue64, &len, NULL, 0)) { - cacheSizeL3 = static_cast<int>(sysctlValue64/1024); - } - MOZ_ASSERT(sizeof(sysctlValue64) == len); - - if (!sysctlbyname("machdep.cpu.vendor", NULL, &len, NULL, 0)) { - char* cpuVendorStr = new char[len]; - if (!sysctlbyname("machdep.cpu.vendor", cpuVendorStr, &len, NULL, 0)) { - cpuVendor = cpuVendorStr; - } - delete [] cpuVendorStr; - } - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.family", &sysctlValue32, &len, NULL, 0)) { - cpuFamily = static_cast<int>(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.model", &sysctlValue32, &len, NULL, 0)) { - cpuModel = static_cast<int>(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - - len = sizeof(sysctlValue32); - if (!sysctlbyname("machdep.cpu.stepping", &sysctlValue32, &len, NULL, 0)) { - cpuStepping = static_cast<int>(sysctlValue32); - } - MOZ_ASSERT(sizeof(sysctlValue32) == len); - #elif defined(XP_LINUX) // Get vendor, family, model, stepping, physical cores, L3 cache size // from /proc/cpuinfo file @@ -655,14 +586,6 @@ nsSystemInfo::Init() } #endif -#if defined(XP_MACOSX) - nsAutoString countryCode; - if (NS_SUCCEEDED(GetSelectedCityInfo(countryCode))) { - rv = SetPropertyAsAString(NS_LITERAL_STRING("countryCode"), countryCode); - NS_ENSURE_SUCCESS(rv, rv); - } -#endif - #if defined(MOZ_WIDGET_GTK) // This must be done here because NSPR can only separate OS's when compiled, not libraries. // 64 bytes is going to be well enough for "GTK " followed by 3 integers diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp index 645b34b87e..e3974b5fca 100644 --- a/xpcom/base/nsUUIDGenerator.cpp +++ b/xpcom/base/nsUUIDGenerator.cpp @@ -6,8 +6,6 @@ #if defined(XP_WIN) #include <windows.h> #include <objbase.h> -#elif defined(XP_MACOSX) -#include <CoreFoundation/CoreFoundation.h> #else #include <stdlib.h> #include "prrng.h" @@ -34,7 +32,7 @@ nsUUIDGenerator::Init() // We're a service, so we're guaranteed that Init() is not going // to be reentered while we're inside Init(). -#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM) +#if !defined(XP_WIN) && !defined(HAVE_ARC4RANDOM) /* initialize random number generator using NSPR random noise */ unsigned int seed; @@ -71,7 +69,7 @@ nsUUIDGenerator::Init() } #endif -#endif /* non XP_WIN and non XP_MACOSX and non ARC4RANDOM */ +#endif /* non XP_WIN and non ARC4RANDOM */ return NS_OK; } @@ -106,17 +104,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* aId) if (FAILED(hr)) { return NS_ERROR_FAILURE; } -#elif defined(XP_MACOSX) - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - if (!uuid) { - return NS_ERROR_FAILURE; - } - - CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuid); - memcpy(aId, &bytes, sizeof(nsID)); - - CFRelease(uuid); -#else /* not windows or OS X; generate randomness using random(). */ +#else /* not windows; generate randomness using random(). */ /* XXX we should be saving the return of setstate here and switching * back to it; instead, we use the value returned when we called * initstate, since older glibc's have broken setstate() return values diff --git a/xpcom/base/nsUUIDGenerator.h b/xpcom/base/nsUUIDGenerator.h index bfd2805eaf..1eadd14eea 100644 --- a/xpcom/base/nsUUIDGenerator.h +++ b/xpcom/base/nsUUIDGenerator.h @@ -28,7 +28,7 @@ private: protected: mozilla::Mutex mLock; -#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(HAVE_ARC4RANDOM) +#if !defined(XP_WIN) && !defined(HAVE_ARC4RANDOM) char mState[128]; char* mSavedState; uint8_t mRBytes; |