mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 1259335 - Part 1.5: Collect use count telemetry for Battery Status API. r=baku
This commit is contained in:
parent
1a83f50401
commit
2fef1eb8e8
@ -204,6 +204,7 @@ Navigator::Init()
|
||||
|
||||
Navigator::Navigator(nsPIDOMWindowInner* aWindow)
|
||||
: mWindow(aWindow)
|
||||
, mBatteryTelemetryReported(false)
|
||||
{
|
||||
MOZ_ASSERT(aWindow->IsInnerWindow(), "Navigator must get an inner window!");
|
||||
}
|
||||
@ -307,6 +308,7 @@ Navigator::Invalidate()
|
||||
}
|
||||
|
||||
mBatteryPromise = nullptr;
|
||||
mBatteryTelemetryReported = false;
|
||||
|
||||
#ifdef MOZ_B2G_FM
|
||||
if (mFMRadio) {
|
||||
@ -1587,6 +1589,10 @@ Navigator::GetBattery(ErrorResult& aRv)
|
||||
}
|
||||
mBatteryPromise = batteryPromise;
|
||||
|
||||
// We just initialized mBatteryPromise, so we know this is the first time
|
||||
// this page has accessed navigator.getBattery(). 1 = navigator.getBattery()
|
||||
Telemetry::Accumulate(Telemetry::BATTERY_STATUS_COUNT, 1);
|
||||
|
||||
if (!mBatteryManager) {
|
||||
mBatteryManager = new battery::BatteryManager(mWindow);
|
||||
mBatteryManager->Init();
|
||||
|
@ -403,6 +403,8 @@ private:
|
||||
|
||||
nsTArray<RefPtr<Promise> > mVRGetDevicesPromises;
|
||||
nsTArray<uint32_t> mRequestedVibrationPattern;
|
||||
|
||||
bool mBatteryTelemetryReported;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -100,6 +100,14 @@
|
||||
"n_values": 21,
|
||||
"description": "Maximum number of concurrent threads reached during a given download session"
|
||||
},
|
||||
"BATTERY_STATUS_COUNT": {
|
||||
"alert_emails": ["cpeterson@mozilla.com"],
|
||||
"bug_numbers": [1259335],
|
||||
"expires_in_version": "52",
|
||||
"kind": "enumerated",
|
||||
"n_values": 10,
|
||||
"description": "Number of pages that use the Battery Status API: 0=navigator.battery, 1=navigator.getBattery()"
|
||||
},
|
||||
"BLOCKLIST_SYNC_FILE_LOAD": {
|
||||
"alert_emails": ["rvitillo@mozilla.com"],
|
||||
"expires_in_version": "35",
|
||||
|
Loading…
Reference in New Issue
Block a user