Backed out changeset a8d6973e5743 (bug 917885) because I pushed the wrong patch
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 19 Sep 2013 14:27:35 -0400
changeset 147963 8b6758f9e90fdd3da96356d020fe3e7f9a161612
parent 147962 951a95bca7c27229001755e760444623624ce51a
child 147964 b39cfce76d29840cf0c2bc45a5f798f1bfec0822
push id25321
push useremorley@mozilla.com
push dateFri, 20 Sep 2013 09:19:10 +0000
treeherdermozilla-central@d923570ed720 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs917885
milestone27.0a1
backs outa8d6973e57432472a359ebdc34aff632db064644
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
Backed out changeset a8d6973e5743 (bug 917885) because I pushed the wrong patch
xpcom/base/AvailableMemoryTracker.cpp
xpcom/base/CycleCollectedJSRuntime.h
xpcom/base/VisualEventTracer.cpp
xpcom/base/VisualEventTracer.h
xpcom/base/nsConsoleMessage.cpp
xpcom/base/nsConsoleService.cpp
xpcom/base/nsConsoleService.h
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsCycleCollector.h
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsErrorService.cpp
xpcom/base/nsGZFileWriter.h
xpcom/base/nsInterfaceRequestorAgg.cpp
xpcom/base/nsInterfaceRequestorAgg.h
xpcom/base/nsMacUtilsImpl.cpp
xpcom/base/nsMemoryImpl.cpp
xpcom/base/nsMemoryImpl.h
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryInfoDumper.h
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsMemoryReporterManager.h
xpcom/base/nsStackWalk.cpp
xpcom/base/nsSystemInfo.cpp
xpcom/base/nsTraceRefcntImpl.cpp
xpcom/base/nsUUIDGenerator.cpp
--- a/xpcom/base/AvailableMemoryTracker.cpp
+++ b/xpcom/base/AvailableMemoryTracker.cpp
@@ -1,27 +1,29 @@
 /* -*- 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/. */
 
 #include "mozilla/AvailableMemoryTracker.h"
 
-#if defined(XP_WIN)
 #include "prinrval.h"
 #include "prenv.h"
-#endif
 
+#include "nsIMemoryReporter.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIRunnable.h"
 #include "nsISupports.h"
-#include "nsThreadUtils.h"
+#include "nsMemoryPressure.h"
+#include "nsPrintfCString.h"
+#include "nsThread.h"
 
+#include "mozilla/Atomics.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 
 #if defined(XP_WIN)
 #   include "nsWindowsDllInterceptor.h"
 #   include <windows.h>
 #endif
 
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSRuntime.h
@@ -4,30 +4,28 @@
  * 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_CycleCollectedJSRuntime_h__
 #define mozilla_CycleCollectedJSRuntime_h__
 
 #include "mozilla/MemoryReporting.h"
 #include "jsapi.h"
+#include "js/Class.h"
 
 #include "nsCycleCollector.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsTArray.h"
 
 class nsCycleCollectionNoteRootCallback;
+class nsScriptObjectTracer;
 class nsIException;
 
-namespace js {
-class Class;
-}
-
 namespace mozilla {
 
 class JSGCThingParticipant: public nsCycleCollectionParticipant
 {
 public:
   NS_IMETHOD Root(void *n)
   {
     return NS_OK;
--- a/xpcom/base/VisualEventTracer.cpp
+++ b/xpcom/base/VisualEventTracer.cpp
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/VisualEventTracer.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/TimeStamp.h"
 #include "nscore.h"
 #include "prthread.h"
 #include "prprf.h"
+#include "prio.h"
 #include "prenv.h"
 #include "plstr.h"
 #include "nsThreadUtils.h"
 
 namespace mozilla { namespace eventtracer {
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
 
--- a/xpcom/base/VisualEventTracer.h
+++ b/xpcom/base/VisualEventTracer.h
@@ -15,22 +15,21 @@
  * the log of all events instrumentation in the mozilla code.
  * Check MOZ_EVENT_TRACER_* macros bellow to add your own.
  *
  * To let the event tracer log only some events to save disk space, export 
  * MOZ_PROFILING_EVENTS with comma separated list of event names you want 
  * to record in the log.
  */
 
-#include <stdint.h>
-#include "mozilla/Attributes.h"
+#include "nscore.h"
 #include "mozilla/GuardObjects.h"
+#include "nsIVisualEventTracer.h"
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
-#include "nsIVisualEventTracer.h"
 
 // Bind an object instance, usually |this|, to a name, usually URL or 
 // host name, the instance deals with for its lifetime.  The name string 
 // is duplicated.
 // IMPORTANT: it is up to the caller to pass the correct static_cast
 // of the |instance| pointer to all these macros ; otherwise the linking
 // of events and objects will not work!
 // The name will show in details of the events on the timeline and also
--- a/xpcom/base/nsConsoleMessage.cpp
+++ b/xpcom/base/nsConsoleMessage.cpp
@@ -3,16 +3,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/. */
 
 /*
  * Base implementation for console messages.
  */
 
 #include "nsConsoleMessage.h"
+#include "nsReadableUtils.h"
 #include "jsapi.h"
 
 NS_IMPL_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage)
 
 nsConsoleMessage::nsConsoleMessage()
     :  mTimeStamp(0),
        mMessage()
 {
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -6,22 +6,24 @@
 /*
  * Maintains a circular buffer of recent messages, and notifies
  * listeners when new messages are logged.
  */
 
 /* Threadsafe. */
 
 #include "nsMemory.h"
+#include "nsIServiceManager.h"
 #include "nsCOMArray.h"
 #include "nsThreadUtils.h"
 
 #include "nsConsoleService.h"
 #include "nsConsoleMessage.h"
 #include "nsIClassInfoImpl.h"
+#include "nsThreadUtils.h"
 
 #include "mozilla/Preferences.h"
 
 #if defined(ANDROID)
 #include <android/log.h>
 #endif
 #ifdef XP_WIN
 #include <windows.h>
--- a/xpcom/base/nsConsoleService.h
+++ b/xpcom/base/nsConsoleService.h
@@ -8,16 +8,17 @@
  */
 
 #ifndef __nsconsoleservice_h__
 #define __nsconsoleservice_h__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 
+#include "nsCOMPtr.h"
 #include "nsInterfaceHashtable.h"
 #include "nsHashKeys.h"
 
 #include "nsIConsoleService.h"
 
 class nsConsoleService MOZ_FINAL : public nsIConsoleService
 {
 public:
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -100,35 +100,44 @@
 
 /* This must occur *after* base/process_util.h to avoid typedefs conflicts. */
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Util.h"
 
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollectionNoteRootCallback.h"
+#include "nsHashKeys.h"
 #include "nsDeque.h"
 #include "nsCycleCollector.h"
 #include "nsThreadUtils.h"
 #include "prenv.h"
+#include "prprf.h"
+#include "plstr.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "nsIConsoleService.h"
+#include "nsTArray.h"
 #include "mozilla/Attributes.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIMemoryReporter.h"
 #include "nsIFile.h"
+#include "nsDirectoryServiceDefs.h"
 #include "nsMemoryInfoDumper.h"
 #include "xpcpublic.h"
+#include "nsXPCOMPrivate.h"
 #include "GeckoProfiler.h"
 #include <stdint.h>
 #include <stdio.h>
-
+#include <string.h>
+
+#include "mozilla/CondVar.h"
 #include "mozilla/Likely.h"
 #include "mozilla/mozPoisonWrite.h"
+#include "mozilla/Mutex.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/ThreadLocal.h"
 
 using namespace mozilla;
 
 //#define COLLECT_TIME_DEBUG
 
 // Enable assertions that are useful for diagnosing errors in graph construction.
--- a/xpcom/base/nsCycleCollector.h
+++ b/xpcom/base/nsCycleCollector.h
@@ -3,16 +3,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/. */
 
 #ifndef nsCycleCollector_h__
 #define nsCycleCollector_h__
 
 class nsICycleCollectorListener;
 class nsISupports;
+class nsScriptObjectTracer;
 
 #include "nsError.h"
 #include "nsID.h"
 
 namespace mozilla {
 
 class CycleCollectedJSRuntime;
 
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -11,46 +11,50 @@
 #include "nsDebugImpl.h"
 #include "nsDebug.h"
 #ifdef MOZ_CRASHREPORTER
 # include "nsExceptionHandler.h"
 #endif
 #include "nsStringGlue.h"
 #include "prprf.h"
 #include "prlog.h"
+#include "prinit.h"
+#include "plstr.h"
 #include "nsError.h"
 #include "prerror.h"
 #include "prerr.h"
 #include "prenv.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
-#ifdef _WIN32
-/* for getenv() */
+#if defined(XP_UNIX) || defined(_WIN32) || defined(XP_OS2)
+/* for abort() and getenv() */
 #include <stdlib.h>
 #endif
 
 #include "nsTraceRefcntImpl.h"
+#include "nsISupportsUtils.h"
 
 #if defined(XP_UNIX)
 #include <signal.h>
 #endif
 
 #if defined(XP_WIN)
 #include <tchar.h>
 #include "nsString.h"
 #ifdef MOZ_METRO
 #include "nsWindowsHelpers.h"
 #endif
 #endif
 
 #if defined(XP_MACOSX)
 #include <stdbool.h>
+#include <sys/types.h>
 #include <unistd.h>
 #include <sys/sysctl.h>
 #endif
 
 #include "mozilla/mozalloc_abort.h"
 
 static void
 Abort(const char *aMsg);
--- a/xpcom/base/nsErrorService.cpp
+++ b/xpcom/base/nsErrorService.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsErrorService.h"
-#include "nsCRTGlue.h"
+#include "nsCRT.h"
 #include "nsAutoPtr.h"
 
 static void*
 CloneCString(nsHashKey *aKey, void *aData, void* closure)
 {
   return NS_strdup((const char*)aData);
 }
 
--- a/xpcom/base/nsGZFileWriter.h
+++ b/xpcom/base/nsGZFileWriter.h
@@ -1,15 +1,16 @@
 /* -*- 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/. */
 
 #include "nsIGZFileWriter.h"
+#include <stdio.h>
 #include "zlib.h"
 
 /**
  * A simple class for writing .gz files.
  */
 class nsGZFileWriter : public nsIGZFileWriter
 {
 public:
--- a/xpcom/base/nsInterfaceRequestorAgg.cpp
+++ b/xpcom/base/nsInterfaceRequestorAgg.cpp
@@ -1,14 +1,13 @@
 /* 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 "nsInterfaceRequestorAgg.h"
-#include "nsIInterfaceRequestor.h"
 #include "nsCOMPtr.h"
 #include "mozilla/Attributes.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 
 class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
 {
 public:
--- a/xpcom/base/nsInterfaceRequestorAgg.h
+++ b/xpcom/base/nsInterfaceRequestorAgg.h
@@ -1,19 +1,18 @@
 /* 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 nsInterfaceRequestorAgg_h__
 #define nsInterfaceRequestorAgg_h__
 
-#include "nsError.h"
+#include "nsIInterfaceRequestor.h"
 
 class nsIEventTarget;
-class nsIInterfaceRequestor;
 
 /**
  * This function returns an instance of nsIInterfaceRequestor that aggregates
  * two nsIInterfaceRequestor instances.  Its GetInterface method queries
  * aFirst for the requested interface and will query aSecond only if aFirst
  * failed to supply the requested interface.  Both aFirst and aSecond may
  * be null, and will be released on the main thread when the aggregator is
  * destroyed.
--- a/xpcom/base/nsMacUtilsImpl.cpp
+++ b/xpcom/base/nsMacUtilsImpl.cpp
@@ -1,16 +1,17 @@
 /* -*- 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 "nsMacUtilsImpl.h"
 
 #include <CoreFoundation/CoreFoundation.h>
+#include <sys/sysctl.h>
 
 NS_IMPL_ISUPPORTS1(nsMacUtilsImpl, nsIMacUtils)
 
 nsresult nsMacUtilsImpl::GetArchString(nsAString& archString)
 {
   if (!mBinaryArchs.IsEmpty()) {
     archString.Assign(mBinaryArchs);
     return NS_OK;
--- a/xpcom/base/nsMemoryImpl.cpp
+++ b/xpcom/base/nsMemoryImpl.cpp
@@ -1,21 +1,28 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsXPCOM.h"
 #include "nsMemoryImpl.h"
 #include "nsThreadUtils.h"
 
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
+#include "nsIServiceManager.h"
 #include "nsISimpleEnumerator.h"
 
+#include "prcvar.h"
+#include "pratom.h"
+
+#include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
+#include "nsString.h"
 #include "mozilla/Services.h"
 
 #ifdef ANDROID
 #include <stdio.h>
 #define LOW_MEMORY_THRESHOLD_KB (384 * 1024)
 #endif
 
 static nsMemoryImpl sGlobalMemory;
--- a/xpcom/base/nsMemoryImpl.h
+++ b/xpcom/base/nsMemoryImpl.h
@@ -5,16 +5,17 @@
 
 #ifndef nsMemoryImpl_h__
 #define nsMemoryImpl_h__
 
 #include "mozilla/Atomics.h"
 
 #include "nsIMemory.h"
 #include "nsIRunnable.h"
+#include "prtime.h"
 
 // nsMemoryImpl is a static object. We can do this because it doesn't have
 // a constructor/destructor or any instance members. Please don't add
 // instance member variables, only static member variables.
 
 class nsMemoryImpl : public nsIMemory
 {
 public:
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -1,29 +1,32 @@
 /* -*- 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/. */
 
 #include "mozilla/nsMemoryInfoDumper.h"
 
-#ifdef XP_LINUX
+#include "mozilla/Atomics.h"
+#include "mozilla/ClearOnShutdown.h"
+#include "mozilla/FileUtils.h"
 #include "mozilla/Preferences.h"
-#endif
+#include "mozilla/StaticPtr.h"
 #include "mozilla/unused.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ContentChild.h"
 #include "nsIConsoleService.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIMemoryReporter.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsGZFileWriter.h"
 #include "nsJSEnvironment.h"
 #include "nsPrintfCString.h"
+#include "pratom.h"
 
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
 
--- a/xpcom/base/nsMemoryInfoDumper.h
+++ b/xpcom/base/nsMemoryInfoDumper.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_nsMemoryInfoDumper_h
 #define mozilla_nsMemoryInfoDumper_h
 
 #include "nsIMemoryInfoDumper.h"
-
-class nsACString;
+#include "nsString.h"
 
 /**
  * This class facilitates dumping information about our memory usage to disk.
  *
  * Its cpp file also has Linux-only code which watches various OS signals and
  * dumps memory info upon receiving a signal.  You can activate these listeners
  * by calling Initialize().
  */
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -3,24 +3,28 @@
 /* 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 "nsAtomTable.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
+#include "nsDirectoryServiceUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMemoryReporterManager.h"
+#include "nsArrayEnumerator.h"
 #include "nsISimpleEnumerator.h"
+#include "nsIFile.h"
+#include "nsIFileStreams.h"
+#include "nsPrintfCString.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
-#if defined(XP_LINUX)
+#include "nsThread.h"
 #include "nsMemoryInfoDumper.h"
-#endif
 #include "mozilla/Telemetry.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Services.h"
 
 #ifndef XP_WIN
 #include <unistd.h>
 #endif
 
@@ -28,16 +32,17 @@ using namespace mozilla;
 
 #if defined(MOZ_MEMORY)
 #  define HAVE_JEMALLOC_STATS 1
 #  include "mozmemory.h"
 #endif  // MOZ_MEMORY
 
 #if defined(XP_LINUX)
 
+#include <unistd.h>
 static nsresult GetProcSelfStatmField(int aField, int64_t* aN)
 {
     // There are more than two fields, but we're only interested in the first
     // two.
     static const int MAX_FIELD = 2;
     size_t fields[MAX_FIELD];
     MOZ_ASSERT(aField < MAX_FIELD, "bad field number");
     FILE* f = fopen("/proc/self/statm", "r");
@@ -445,16 +450,17 @@ public:
     {}
 
     NS_IMETHOD GetAmount(int64_t* aAmount) { return GetResidentFast(aAmount); }
 };
 #endif  // HAVE_VSIZE_AND_RESIDENT_REPORTERS
 
 #ifdef XP_UNIX
 
+#include <sys/time.h>
 #include <sys/resource.h>
 
 #define HAVE_PAGE_FAULT_REPORTERS 1
 
 class PageFaultsSoftReporter MOZ_FINAL : public MemoryUniReporter
 {
 public:
     PageFaultsSoftReporter()
--- a/xpcom/base/nsMemoryReporterManager.h
+++ b/xpcom/base/nsMemoryReporterManager.h
@@ -1,16 +1,18 @@
 /* -*- 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/. */
 
 #include "nsIMemoryReporter.h"
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
+#include "nsString.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 
 using mozilla::Mutex;
 
 class nsMemoryReporterManager : public nsIMemoryReporterManager
 {
 public:
--- a/xpcom/base/nsStackWalk.cpp
+++ b/xpcom/base/nsStackWalk.cpp
@@ -1,18 +1,19 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
 /* 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/. */
 
 /* API for getting a stack trace of the C/C++ stack on the current thread */
 
+#include "mozilla/Util.h"
 #include "mozilla/StackWalk.h"
-#include "mozilla/Assertions.h"
+#include "nsDebug.h"
 #include "nsStackWalkPrivate.h"
 
 #include "nsStackWalk.h"
 
 using namespace mozilla;
 
 // The presence of this address is the stack must stop the stack walk. If
 // there is no such address, the structure will be {NULL, true}.
@@ -36,16 +37,17 @@ static CriticalAddress gCriticalAddress;
       defined(HAVE__UNWIND_BACKTRACE)))
 
 #define NSSTACKWALK_SUPPORTS_SOLARIS \
     (defined(__sun) && \
      (defined(__sparc) || defined(sparc) || defined(__i386) || defined(i386)))
 
 #if NSSTACKWALK_SUPPORTS_MACOSX
 #include <pthread.h>
+#include <errno.h>
 #include <CoreServices/CoreServices.h>
 
 typedef void
 malloc_logger_t(uint32_t type, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
                 uintptr_t result, uint32_t num_hot_frames_to_skip);
 extern malloc_logger_t *malloc_logger;
 
 static void
@@ -807,32 +809,34 @@ NS_FormatCodeAddressDetails(void *aPC, c
 }
 
 // WIN32 x86 stack walking code
 // i386 or PPC Linux stackwalking code or Solaris
 #elif HAVE_DLADDR && (HAVE__UNWIND_BACKTRACE || NSSTACKWALK_SUPPORTS_LINUX || NSSTACKWALK_SUPPORTS_SOLARIS || NSSTACKWALK_SUPPORTS_MACOSX)
 
 #include <stdlib.h>
 #include <string.h>
+#include <math.h>
 #include "nscore.h"
 #include <stdio.h>
 #include "plstr.h"
 
 // On glibc 2.1, the Dl_info api defined in <dlfcn.h> is only exposed
 // if __USE_GNU is defined.  I suppose its some kind of standards
 // adherence thing.
 //
 #if (__GLIBC_MINOR__ >= 1) && !defined(__USE_GNU)
 #define __USE_GNU
 #endif
 
 // This thing is exported by libstdc++
 // Yes, this is a gcc only hack
 #if defined(MOZ_DEMANGLE_SYMBOLS)
 #include <cxxabi.h>
+#include <stdlib.h> // for free()
 #endif // MOZ_DEMANGLE_SYMBOLS
 
 void DemangleSymbol(const char * aSymbol, 
                     char * aBuffer,
                     int aBufLen)
 {
     aBuffer[0] = '\0';
 
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -2,16 +2,18 @@
 /* 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 "mozilla/Util.h"
 
 #include "nsSystemInfo.h"
 #include "prsystem.h"
+#include "nsString.h"
+#include "prprf.h"
 #include "mozilla/SSE.h"
 #include "mozilla/arm.h"
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 #ifdef MOZ_WIDGET_GTK
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -4,22 +4,27 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsTraceRefcntImpl.h"
 #include "nsXPCOMPrivate.h"
 #include "nscore.h"
 #include "nsISupports.h"
 #include "nsTArray.h"
 #include "prenv.h"
+#include "prprf.h"
+#include "prlog.h"
 #include "plstr.h"
 #include "prlink.h"
+#include <stdlib.h>
+#include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include <math.h>
 #include "nsStackWalkPrivate.h"
 #include "nsStackWalk.h"
+#include "nsString.h"
 
 #include "nsXULAppAPI.h"
 #ifdef XP_WIN
 #include <process.h>
 #define getpid _getpid
 #else
 #include <unistd.h>
 #endif
--- a/xpcom/base/nsUUIDGenerator.cpp
+++ b/xpcom/base/nsUUIDGenerator.cpp
@@ -8,16 +8,18 @@
 #include <objbase.h>
 #elif defined(XP_MACOSX)
 #include <CoreFoundation/CoreFoundation.h>
 #else
 #include <stdlib.h>
 #include "prrng.h"
 #endif
 
+#include "nsMemory.h"
+
 #include "nsUUIDGenerator.h"
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator)
 
 nsUUIDGenerator::nsUUIDGenerator()
     : mLock("nsUUIDGenerator.mLock")