Issue #1053 - Remove MOZ_WIDGET_ANDROID and IDB_MOBILE

This commit is contained in:
Moonchild 2021-03-11 06:43:10 +00:00 committed by roytam1
commit 348c6604be
43 changed files with 14 additions and 1048 deletions

View file

@ -582,7 +582,6 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret)
}
#if !defined(MOZ_WIDGET_ANDROID)
/**
* This clones a histogram |existing| with the id |existingId| to a
@ -670,7 +669,6 @@ internal_GetSubsessionHistogram(Histogram& existing)
cache[id] = clone;
return clone;
}
#endif
nsresult
internal_HistogramAdd(Histogram& histogram, int32_t value, uint32_t dataset)
@ -683,11 +681,9 @@ internal_HistogramAdd(Histogram& histogram, int32_t value, uint32_t dataset)
return NS_OK;
}
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(histogram)) {
subsession->Add(value);
}
#endif
// It is safe to add to the histogram now: the subsession histogram was already
// cloned from this so we won't add the sample twice.
@ -728,11 +724,9 @@ internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
aHistogram.Clear();
}
#if !defined(MOZ_WIDGET_ANDROID)
if (Histogram* subsession = internal_GetSubsessionHistogram(aHistogram)) {
subsession->Clear();
}
#endif
}
} // namespace
@ -925,9 +919,7 @@ private:
typedef nsBaseHashtableET<nsCStringHashKey, Histogram*> KeyedHistogramEntry;
typedef AutoHashtable<KeyedHistogramEntry> KeyedHistogramMapType;
KeyedHistogramMapType mHistogramMap;
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType mSubsessionMap;
#endif
static bool ReflectKeyedHistogram(KeyedHistogramEntry* entry,
JSContext* cx,
@ -949,9 +941,7 @@ KeyedHistogram::KeyedHistogram(const nsACString &name,
uint32_t min, uint32_t max,
uint32_t bucketCount, uint32_t dataset)
: mHistogramMap()
#if !defined(MOZ_WIDGET_ANDROID)
, mSubsessionMap()
#endif
, mName(name)
, mExpiration(expiration)
, mHistogramType(histogramType)
@ -967,11 +957,7 @@ nsresult
KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
bool subsession)
{
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
#endif
KeyedHistogramEntry* entry = map.GetEntry(key);
if (entry) {
*histogram = entry->mData;
@ -979,11 +965,9 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
}
nsCString histogramName;
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
histogramName.AppendLiteral(SUBSESSION_HISTOGRAM_PREFIX);
}
#endif
histogramName.Append(mName);
histogramName.AppendLiteral(KEYED_HISTOGRAM_NAME_SEPARATOR);
histogramName.Append(key);
@ -1041,22 +1025,18 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
if (!histogram) {
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_ANDROID)
Histogram* subsession = GetHistogram(key, true);
MOZ_ASSERT(subsession);
if (!subsession) {
return NS_ERROR_FAILURE;
}
#endif
if (!IsRecordingEnabled()) {
return NS_OK;
}
histogram->Add(sample);
#if !defined(MOZ_WIDGET_ANDROID)
subsession->Add(sample);
#endif
return NS_OK;
}
@ -1067,7 +1047,6 @@ KeyedHistogram::Clear(bool onlySubsession)
if (!XRE_IsParentProcess()) {
return;
}
#if !defined(MOZ_WIDGET_ANDROID)
for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mData->Clear();
}
@ -1075,7 +1054,6 @@ KeyedHistogram::Clear(bool onlySubsession)
if (onlySubsession) {
return;
}
#endif
for (auto iter = mHistogramMap.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mData->Clear();
@ -1136,20 +1114,14 @@ nsresult
KeyedHistogram::GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
bool subsession, bool clearSubsession)
{
#if !defined(MOZ_WIDGET_ANDROID)
KeyedHistogramMapType& map = subsession ? mSubsessionMap : mHistogramMap;
#else
KeyedHistogramMapType& map = mHistogramMap;
#endif
if (!map.ReflectIntoJS(&KeyedHistogram::ReflectKeyedHistogram, cx, obj)) {
return NS_ERROR_FAILURE;
}
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
Clear(true);
}
#endif
return NS_OK;
}
@ -1636,7 +1608,6 @@ internal_JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
}
bool onlySubsession = false;
#if !defined(MOZ_WIDGET_ANDROID)
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (args.length() >= 1) {
@ -1647,7 +1618,6 @@ internal_JSHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
onlySubsession = JS::ToBoolean(args[0]);
}
#endif
Histogram *h = static_cast<Histogram*>(JS_GetPrivate(obj));
MOZ_ASSERT(h);
@ -1873,16 +1843,13 @@ internal_JSKeyedHistogram_Snapshot(JSContext *cx, unsigned argc, JS::Value *vp)
return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, false, false);
}
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SubsessionSnapshot(JSContext *cx,
unsigned argc, JS::Value *vp)
{
return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, true, false);
}
#endif
#if !defined(MOZ_WIDGET_ANDROID)
bool
internal_JSKeyedHistogram_SnapshotSubsessionAndClear(JSContext *cx,
unsigned argc,
@ -1895,7 +1862,6 @@ internal_JSKeyedHistogram_SnapshotSubsessionAndClear(JSContext *cx,
return internal_KeyedHistogram_SnapshotImpl(cx, argc, vp, true, true);
}
#endif
bool
internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
@ -1910,7 +1876,6 @@ internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
return false;
}
#if !defined(MOZ_WIDGET_ANDROID)
bool onlySubsession = false;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -1924,9 +1889,6 @@ internal_JSKeyedHistogram_Clear(JSContext *cx, unsigned argc, JS::Value *vp)
}
keyed->Clear(onlySubsession);
#else
keyed->Clear(false);
#endif
return true;
}
@ -1973,12 +1935,10 @@ internal_WrapAndReturnKeyedHistogram(KeyedHistogram *h, JSContext *cx,
if (!(JS_DefineFunction(cx, obj, "add", internal_JSKeyedHistogram_Add, 2, 0)
&& JS_DefineFunction(cx, obj, "snapshot",
internal_JSKeyedHistogram_Snapshot, 1, 0)
#if !defined(MOZ_WIDGET_ANDROID)
&& JS_DefineFunction(cx, obj, "subsessionSnapshot",
internal_JSKeyedHistogram_SubsessionSnapshot, 1, 0)
&& JS_DefineFunction(cx, obj, "snapshotSubsessionAndClear",
internal_JSKeyedHistogram_SnapshotSubsessionAndClear, 0, 0)
#endif
&& JS_DefineFunction(cx, obj, "keys",
internal_JSKeyedHistogram_Keys, 0, 0)
&& JS_DefineFunction(cx, obj, "clear",
@ -2419,14 +2379,12 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
h = internal_GetSubsessionHistogram(*h);
if (!h) {
continue;
}
}
#endif
hobj = JS_NewPlainObject(cx);
if (!hobj) {
@ -2447,11 +2405,9 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
}
}
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
h->Clear();
}
#endif
}
return NS_OK;
}