Bug 1332639 - Fix nsBrowserApp.cpp and related headers to compile without the external string API, r?glandium
MozReview-Commit-ID: CQjtpA2lxAM
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -16,17 +16,16 @@
#endif
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "nsCOMPtr.h"
#include "nsIFile.h"
-#include "nsStringGlue.h"
#ifdef XP_WIN
#ifdef MOZ_ASAN
// ASAN requires firefox.exe to be built with -MD, and it's OK if we don't
// support Windows XP SP2 in ASAN builds.
#define XRE_DONT_SUPPORT_XPSP2
#endif
#define XRE_WANT_ENVIRON
@@ -35,17 +34,17 @@
#include "mozilla/sandboxing/SandboxInitialization.h"
#endif
#endif
#include "BinaryPath.h"
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
#include "mozilla/Sprintf.h"
-#include "mozilla/Telemetry.h"
+#include "mozilla/StartupTimeline.h"
#include "mozilla/WindowsDllBlocklist.h"
#ifdef LIBFUZZER
#include "FuzzerDefs.h"
#endif
#ifdef MOZ_LINUX_32_SSE2_STARTUP_ERROR
#include <cpuid.h>
--- a/toolkit/components/startup/StartupTimeline.h
+++ b/toolkit/components/startup/StartupTimeline.h
@@ -25,17 +25,20 @@ mozilla_StartupTimeline_Event(QUIT_APPLI
mozilla_StartupTimeline_Event(PROFILE_BEFORE_CHANGE, "profileBeforeChange")
#else
#ifndef mozilla_StartupTimeline
#define mozilla_StartupTimeline
#include "mozilla/TimeStamp.h"
#include "nscore.h"
+
+#ifdef MOZILLA_INTERNAL_API
#include "GeckoProfiler.h"
+#endif
#ifdef MOZ_LINKER
extern "C" {
/* This symbol is resolved by the custom linker. The function it resolves
* to dumps some statistics about the linker at the key events recorded
* by the startup timeline. */
extern void __moz_linker_stats(const char *str)
NS_VISIBILITY_DEFAULT __attribute__((weak));
@@ -61,16 +64,17 @@ public:
static TimeStamp Get(Event ev) {
return sStartupTimeline[ev];
}
static const char *Describe(Event ev) {
return sStartupTimelineDesc[ev];
}
+#ifdef MOZILLA_INTERNAL_API
static void Record(Event ev) {
PROFILER_MARKER(Describe(ev));
Record(ev, TimeStamp::Now());
}
static void Record(Event ev, TimeStamp when) {
sStartupTimeline[ev] = when;
#ifdef MOZ_LINKER
@@ -78,16 +82,17 @@ public:
__moz_linker_stats(Describe(ev));
#endif
}
static void RecordOnce(Event ev) {
if (!HasRecord(ev))
Record(ev);
}
+#endif
static bool HasRecord(Event ev) {
return !sStartupTimeline[ev].IsNull();
}
private:
static NS_EXTERNAL_VIS_(TimeStamp) sStartupTimeline[MAX_EVENT_ID];
static NS_EXTERNAL_VIS_(const char *) sStartupTimelineDesc[MAX_EVENT_ID];
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -14,16 +14,20 @@
#include <CoreFoundation/CoreFoundation.h>
#elif defined(XP_UNIX)
#include <sys/stat.h>
#include <string.h>
#endif
#include "mozilla/UniquePtr.h"
#include "mozilla/UniquePtrExtensions.h"
+#ifdef MOZILLA_INTERNAL_API
+#include "nsString.h"
+#endif
+
namespace mozilla {
class BinaryPath
{
public:
#ifdef XP_WIN
static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
{
@@ -163,16 +167,17 @@ public:
if (NS_FAILED(Get(aArgv0, path))) {
return nullptr;
}
UniqueFreePtr<char> result;
result.reset(strdup(path));
return result;
}
+#ifdef MOZILLA_INTERNAL_API
static nsresult GetFile(const char* aArgv0, nsIFile** aResult)
{
nsCOMPtr<nsIFile> lf;
#ifdef XP_WIN
wchar_t exePath[MAXPATHLEN];
nsresult rv = GetW(aArgv0, exePath);
#else
char exePath[MAXPATHLEN];
@@ -189,13 +194,14 @@ public:
getter_AddRefs(lf));
#endif
if (NS_FAILED(rv)) {
return rv;
}
NS_ADDREF(*aResult = lf);
return NS_OK;
}
+#endif
};
} // namespace mozilla
#endif /* mozilla_BinaryPath_h */