diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index f416ab6e23f8..e48060d2ab73 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -50,6 +50,7 @@ #include "nsTHashtable.h" #include "nsHashKeys.h" #include "nsBaseHashtable.h" +#include "nsXULAppAPI.h" namespace { @@ -359,3 +360,13 @@ Accumulate(ID aHistogram, PRUint32 aSample) } // namespace mozilla NSMODULE_DEFN(nsTelemetryModule) = &kTelemetryModule; + +/** + * The XRE_TelemetryAdd function is to be used by embedding applications + * that can't use mozilla::Telemetry::Accumulate() directly. + */ +void +XRE_TelemetryAccumulate(int aID, PRUint32 aSample) +{ + mozilla::Telemetry::Accumulate((mozilla::Telemetry::ID) aID, aSample); +} diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h index 887aa92582e9..c11ee1a7d877 100644 --- a/xpcom/build/nsXULAppAPI.h +++ b/xpcom/build/nsXULAppAPI.h @@ -569,4 +569,7 @@ XRE_API(void, XRE_SetupDllBlocklist, ()) #endif +XRE_API(void, + XRE_TelemetryAccumulate, (int aID, PRUint32 aSample)) + #endif // _nsXULAppAPI_h__