Bug 1882714 [wpt PR 44850] - Update wpt metadata, a=testonly
[gecko.git] / widget / android / Telemetry.h
blobea8f2dd418032d18a6c3bfc13bc169c839c51a0b
1 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_Telemetry_h__
7 #define mozilla_widget_Telemetry_h__
9 #include "mozilla/java/TelemetryUtilsNatives.h"
10 #include "nsAppShell.h"
11 #include "nsIAndroidBridge.h"
13 #include "mozilla/TimeStamp.h"
14 #include "mozilla/glean/GleanMetrics.h"
16 namespace mozilla {
17 namespace widget {
19 class Telemetry final : public java::TelemetryUtils::Natives<Telemetry> {
20 Telemetry() = delete;
22 public:
23 static void AddHistogram(jni::String::Param aName, int32_t aValue) {
24 MOZ_ASSERT(aName);
25 nsCString name = aName->ToCString();
26 if (name.EqualsLiteral("GV_STARTUP_RUNTIME_MS")) {
27 glean::geckoview::startup_runtime.AccumulateRawDuration(
28 TimeDuration::FromMilliseconds(aValue));
29 } else if (name.EqualsLiteral("GV_CONTENT_PROCESS_LIFETIME_MS")) {
30 glean::geckoview::content_process_lifetime.AccumulateRawDuration(
31 TimeDuration::FromMilliseconds(aValue));
36 } // namespace widget
37 } // namespace mozilla
39 #endif // mozilla_widget_Telemetry_h__