mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1913624 - Remove expired telemetry histograms PRINT_BACKGROUND_TASK_TIME_MS and PRINT_BACKGROUND_TASK_ROUND_TRIP_TIME_MS, r=win-reviewers,gstoll,TravisLong.
Depends on D219462 Differential Revision: https://phabricator.services.mozilla.com/D219463
This commit is contained in:
parent
c43501d761
commit
ab931780f4
@ -10032,32 +10032,6 @@
|
||||
"n_buckets": 50,
|
||||
"description": "(Bug 1207089) Time in ms between displaying a popup notification and dismissing it without an action the first time, keyed by ID"
|
||||
},
|
||||
"PRINT_BACKGROUND_TASK_TIME_MS": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["jwatt@jwatt.org"],
|
||||
"expires_in_version": "95",
|
||||
"description": "Milliseconds taken on the background thread only for print background tasks. Keys describe the task, usually the information being retrieved, current possible keys are: DefaultSettings, MarginsForPaper, Printers, NamedPrinter, NamedOrDefaultPrinter, SupportsDuplex, SupportsColor, SupportsCollation, PaperList.",
|
||||
"keyed": true,
|
||||
"kind": "exponential",
|
||||
"high": 10000,
|
||||
"n_buckets": 50,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"bug_numbers": [1660686]
|
||||
},
|
||||
"PRINT_BACKGROUND_TASK_ROUND_TRIP_TIME_MS": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["jwatt@jwatt.org"],
|
||||
"expires_in_version": "95",
|
||||
"description": "Milliseconds taken for print background tasks from spawning to background thread back to before resolving or rejecting on the main thread. See PRINT_BACKGROUND_TASK_TIME_MS for key description.",
|
||||
"keyed": true,
|
||||
"kind": "exponential",
|
||||
"high": 10000,
|
||||
"n_buckets": 50,
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"bug_numbers": [1660686]
|
||||
},
|
||||
"PRINT_INIT_TO_PLATFORM_SENT_SETTINGS_MS": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
@ -30,7 +29,7 @@ using PrintBackgroundTask = Result (T::*)(Args...) const;
|
||||
|
||||
template <typename T, typename Result, typename... Args>
|
||||
void SpawnPrintBackgroundTask(
|
||||
T& aReceiver, dom::Promise& aPromise, const nsCString& aTelemetryKey,
|
||||
T& aReceiver, dom::Promise& aPromise,
|
||||
PrintBackgroundTask<T, Result, Args...> aBackgroundTask, Args... aArgs) {
|
||||
auto promiseHolder = MakeRefPtr<nsMainThreadPtrHolder<dom::Promise>>(
|
||||
"nsPrinterBase::SpawnBackgroundTaskPromise", &aPromise);
|
||||
@ -47,26 +46,18 @@ void SpawnPrintBackgroundTask(
|
||||
NS_NewRunnableFunction(
|
||||
"SpawnPrintBackgroundTask",
|
||||
[holder = std::move(holder), promiseHolder = std::move(promiseHolder),
|
||||
aTelemetryKey, startRoundTrip = TimeStamp::Now(),
|
||||
backgroundTask = aBackgroundTask,
|
||||
aArgs = std::make_tuple(std::forward<Args>(aArgs)...)] {
|
||||
auto start = TimeStamp::Now();
|
||||
Result result = std::apply(
|
||||
[&](auto&&... args) {
|
||||
return (holder->get()->*backgroundTask)(args...);
|
||||
},
|
||||
std::move(aArgs));
|
||||
Telemetry::AccumulateTimeDelta(
|
||||
Telemetry::PRINT_BACKGROUND_TASK_TIME_MS, aTelemetryKey, start);
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
"SpawnPrintBackgroundTaskResolution",
|
||||
[holder = std::move(holder),
|
||||
promiseHolder = std::move(promiseHolder),
|
||||
telemetryKey = std::move(aTelemetryKey), startRoundTrip,
|
||||
result = std::move(result)] {
|
||||
Telemetry::AccumulateTimeDelta(
|
||||
Telemetry::PRINT_BACKGROUND_TASK_ROUND_TRIP_TIME_MS,
|
||||
telemetryKey, startRoundTrip);
|
||||
ResolveOrReject(*promiseHolder->get(), *holder->get(),
|
||||
result);
|
||||
}));
|
||||
@ -79,7 +70,6 @@ void SpawnPrintBackgroundTask(
|
||||
template <typename T, typename Result, typename... Args>
|
||||
nsresult PrintBackgroundTaskPromise(
|
||||
T& aReceiver, JSContext* aCx, dom::Promise** aResultPromise,
|
||||
const nsCString& aTelemetryKey,
|
||||
PrintBackgroundTask<T, Result, Args...> aTask, Args... aArgs) {
|
||||
ErrorResult rv;
|
||||
RefPtr<dom::Promise> promise =
|
||||
@ -88,7 +78,7 @@ nsresult PrintBackgroundTaskPromise(
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
SpawnPrintBackgroundTask(aReceiver, *promise, aTelemetryKey, aTask,
|
||||
SpawnPrintBackgroundTask(aReceiver, *promise, aTask,
|
||||
std::forward<Args>(aArgs)...);
|
||||
|
||||
promise.forget(aResultPromise);
|
||||
@ -100,16 +90,15 @@ nsresult PrintBackgroundTaskPromise(
|
||||
template <typename T, typename Result, typename... Args>
|
||||
nsresult AsyncPromiseAttributeGetter(
|
||||
T& aReceiver, RefPtr<dom::Promise>& aPromiseSlot, JSContext* aCx,
|
||||
dom::Promise** aResultPromise, const nsCString& aTelemetryKey,
|
||||
dom::Promise** aResultPromise,
|
||||
PrintBackgroundTask<T, Result, Args...> aTask, Args... aArgs) {
|
||||
if (RefPtr<dom::Promise> existing = aPromiseSlot) {
|
||||
existing.forget(aResultPromise);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
PrintBackgroundTaskPromise(aReceiver, aCx, aResultPromise, aTelemetryKey,
|
||||
aTask, std::forward<Args>(aArgs)...);
|
||||
nsresult rv = PrintBackgroundTaskPromise(aReceiver, aCx, aResultPromise,
|
||||
aTask, std::forward<Args>(aArgs)...);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aPromiseSlot = *aResultPromise;
|
||||
|
@ -125,14 +125,9 @@ nsresult nsPrinterBase::AsyncPromiseAttributeGetter(
|
||||
BackgroundTask<T, Args...> aBackgroundTask, Args... aArgs) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
static constexpr EnumeratedArray<AsyncAttribute, nsLiteralCString,
|
||||
size_t(AsyncAttribute::Last)>
|
||||
attributeKeys{"SupportsDuplex"_ns, "SupportsColor"_ns,
|
||||
"SupportsMonochrome"_ns, "SupportsCollation"_ns,
|
||||
"PrinterInfo"_ns};
|
||||
return mozilla::AsyncPromiseAttributeGetter(
|
||||
*this, mAsyncAttributePromises[aAttribute], aCx, aResultPromise,
|
||||
attributeKeys[aAttribute], aBackgroundTask, std::forward<Args>(aArgs)...);
|
||||
aBackgroundTask, std::forward<Args>(aArgs)...);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrinterBase::CopyFromWithValidation(
|
||||
@ -196,7 +191,7 @@ NS_IMETHODIMP nsPrinterBase::GetPrinterInfo(JSContext* aCx,
|
||||
|
||||
void nsPrinterBase::QueryMarginsForPaper(Promise& aPromise,
|
||||
const nsString& aPaperId) {
|
||||
return SpawnPrintBackgroundTask(*this, aPromise, "MarginsForPaper"_ns,
|
||||
return SpawnPrintBackgroundTask(*this, aPromise,
|
||||
&nsPrinterBase::GetMarginsForPaper, aPaperId);
|
||||
}
|
||||
|
||||
|
@ -61,16 +61,15 @@ void ResolveOrReject(dom::Promise& aPromise, nsPrinterListBase& aList,
|
||||
NS_IMETHODIMP nsPrinterListBase::GetPrinters(JSContext* aCx,
|
||||
Promise** aResult) {
|
||||
EnsureCommonPaperInfo(aCx);
|
||||
return mozilla::AsyncPromiseAttributeGetter(*this, mPrintersPromise, aCx,
|
||||
aResult, "Printers"_ns,
|
||||
&nsPrinterListBase::Printers);
|
||||
return mozilla::AsyncPromiseAttributeGetter(
|
||||
*this, mPrintersPromise, aCx, aResult, &nsPrinterListBase::Printers);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrinterListBase::GetPrinterByName(const nsAString& aPrinterName,
|
||||
JSContext* aCx,
|
||||
Promise** aResult) {
|
||||
EnsureCommonPaperInfo(aCx);
|
||||
return PrintBackgroundTaskPromise(*this, aCx, aResult, "PrinterByName"_ns,
|
||||
return PrintBackgroundTaskPromise(*this, aCx, aResult,
|
||||
&nsPrinterListBase::PrinterByName,
|
||||
nsString{aPrinterName});
|
||||
}
|
||||
@ -78,17 +77,17 @@ NS_IMETHODIMP nsPrinterListBase::GetPrinterByName(const nsAString& aPrinterName,
|
||||
NS_IMETHODIMP nsPrinterListBase::GetPrinterBySystemName(
|
||||
const nsAString& aPrinterName, JSContext* aCx, Promise** aResult) {
|
||||
EnsureCommonPaperInfo(aCx);
|
||||
return PrintBackgroundTaskPromise(
|
||||
*this, aCx, aResult, "PrinterBySystemName"_ns,
|
||||
&nsPrinterListBase::PrinterBySystemName, nsString{aPrinterName});
|
||||
return PrintBackgroundTaskPromise(*this, aCx, aResult,
|
||||
&nsPrinterListBase::PrinterBySystemName,
|
||||
nsString{aPrinterName});
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrinterListBase::GetNamedOrDefaultPrinter(
|
||||
const nsAString& aPrinterName, JSContext* aCx, Promise** aResult) {
|
||||
EnsureCommonPaperInfo(aCx);
|
||||
return PrintBackgroundTaskPromise(
|
||||
*this, aCx, aResult, "NamedOrDefaultPrinter"_ns,
|
||||
&nsPrinterListBase::NamedOrDefaultPrinter, nsString{aPrinterName});
|
||||
return PrintBackgroundTaskPromise(*this, aCx, aResult,
|
||||
&nsPrinterListBase::NamedOrDefaultPrinter,
|
||||
nsString{aPrinterName});
|
||||
}
|
||||
|
||||
Maybe<PrinterInfo> nsPrinterListBase::NamedOrDefaultPrinter(
|
||||
|
@ -204,9 +204,9 @@ NS_IMETHODIMP nsPrinterWin::CopyFromWithValidation(
|
||||
|
||||
PrintSettingsInitializer settingsInitializer =
|
||||
aSettingsToCopyFrom->GetSettingsInitializer();
|
||||
return PrintBackgroundTaskPromise(
|
||||
*this, aCx, aResultPromise, "CopyFromWithValidation"_ns,
|
||||
&nsPrinterWin::GetValidatedSettings, settingsInitializer);
|
||||
return PrintBackgroundTaskPromise(*this, aCx, aResultPromise,
|
||||
&nsPrinterWin::GetValidatedSettings,
|
||||
settingsInitializer);
|
||||
}
|
||||
|
||||
bool nsPrinterWin::SupportsDuplex() const {
|
||||
|
Loading…
Reference in New Issue
Block a user