mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Backed out changeset a7907f9f7bab (bug 1218576)
This commit is contained in:
parent
248a404d46
commit
6bbdc8d953
@ -336,16 +336,6 @@ HistogramInfo::label_id(const char* label, uint32_t* labelId) const
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool
|
||||
StringEndsWith(const std::string& name, const std::string& suffix)
|
||||
{
|
||||
if (name.size() < suffix.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return name.compare(name.size() - suffix.size(), suffix.size(), suffix) == 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -430,18 +420,6 @@ internal_HistogramGet(const char *name, const char *expiration,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
CharPtrEntryType*
|
||||
internal_GetHistogramMapEntry(const char* name)
|
||||
{
|
||||
nsDependentCString histogramName(name);
|
||||
NS_NAMED_LITERAL_CSTRING(suffix, CHILD_HISTOGRAM_SUFFIX);
|
||||
if (!StringEndsWith(histogramName, suffix)) {
|
||||
return gHistogramMap.GetEntry(name);
|
||||
}
|
||||
auto root = Substring(histogramName, 0, histogramName.Length() - suffix.Length());
|
||||
return gHistogramMap.GetEntry(PromiseFlatCString(root).get());
|
||||
}
|
||||
|
||||
nsresult
|
||||
internal_GetHistogramEnumId(const char *name, mozilla::Telemetry::ID *id)
|
||||
{
|
||||
@ -449,7 +427,7 @@ internal_GetHistogramEnumId(const char *name, mozilla::Telemetry::ID *id)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
CharPtrEntryType *entry = internal_GetHistogramMapEntry(name);
|
||||
CharPtrEntryType *entry = gHistogramMap.GetEntry(name);
|
||||
if (!entry) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
@ -521,9 +499,7 @@ internal_GetHistogramByName(const nsACString &name, Histogram **ret)
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool isChild = StringEndsWith(name,
|
||||
NS_LITERAL_CSTRING(CHILD_HISTOGRAM_SUFFIX));
|
||||
rv = internal_GetHistogramByEnumId(id, ret, isChild);
|
||||
rv = internal_GetHistogramByEnumId(id, ret);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -579,7 +555,6 @@ internal_CloneHistogram(const nsACString& newName,
|
||||
}
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
Histogram*
|
||||
internal_GetSubsessionHistogram(Histogram& existing)
|
||||
{
|
||||
@ -590,14 +565,9 @@ internal_GetSubsessionHistogram(Histogram& existing)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isChild = StringEndsWith(existing.histogram_name(),
|
||||
CHILD_HISTOGRAM_SUFFIX);
|
||||
|
||||
static Histogram* subsession[mozilla::Telemetry::HistogramCount] = {};
|
||||
static Histogram* subsessionChild[mozilla::Telemetry::HistogramCount] = {};
|
||||
Histogram* cached = isChild ? subsessionChild[id] : subsession[id];
|
||||
if (cached) {
|
||||
return cached;
|
||||
if (subsession[id]) {
|
||||
return subsession[id];
|
||||
}
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(prefix, SUBSESSION_HISTOGRAM_PREFIX);
|
||||
@ -607,15 +577,10 @@ internal_GetSubsessionHistogram(Histogram& existing)
|
||||
}
|
||||
|
||||
nsCString subsessionName(prefix);
|
||||
subsessionName.Append(existing.histogram_name().c_str());
|
||||
subsessionName.Append(existingName);
|
||||
|
||||
Histogram* clone = internal_CloneHistogram(subsessionName, id, existing);
|
||||
if (isChild) {
|
||||
subsessionChild[id] = clone;
|
||||
} else {
|
||||
subsession[id] = clone;
|
||||
}
|
||||
return clone;
|
||||
subsession[id] = internal_CloneHistogram(subsessionName, id, existing);
|
||||
return subsession[id];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user