Bug 1949038 - Add a boolean value to the PageloadEvent to store user hard disk info (SSD/HDD) r=acreskey,sekim,firefox-desktop-core-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D238807
This commit is contained in:
@@ -1500,6 +1500,15 @@ BrowserGlue.prototype = {
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "Init hasSSD for SystemInfo",
|
||||
condition: AppConstants.platform == "win",
|
||||
// Initializes diskInfo to be able to get hasSSD which is part
|
||||
// of the PageLoad event. Only runs on windows, since diskInfo
|
||||
// is a no-op on other platforms
|
||||
task: () => Services.sysinfo.diskInfo,
|
||||
},
|
||||
|
||||
{
|
||||
name: "browser-startup-idle-tasks-finished",
|
||||
task: () => {
|
||||
|
||||
@@ -6171,6 +6171,22 @@ mozilla::ipc::IPCResult ContentParent::RecvRecordPageLoadEvent(
|
||||
mozilla::glean::perf::PageLoadExtra&& aPageLoadEventExtra) {
|
||||
// Check whether a webdriver is running.
|
||||
aPageLoadEventExtra.usingWebdriver = mozilla::Some(WebdriverRunning());
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// The "hasSSD" property is only set on Windows during the first
|
||||
// call to nsISystemInfo.diskInfo - which is done before
|
||||
// browser-startup-idle-tasks-finished
|
||||
// Other platforms do not compute hasSSD, so there's no reason to
|
||||
// query this on other platforms.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPropertyBag2> infoService =
|
||||
mozilla::components::SystemInfo::Service();
|
||||
bool hasSSD;
|
||||
rv = infoService->GetPropertyAsBool(u"hasSSD"_ns, &hasSSD);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aPageLoadEventExtra.hasSsd = Some(hasSSD);
|
||||
}
|
||||
#endif
|
||||
mozilla::glean::perf::page_load.Record(mozilla::Some(aPageLoadEventExtra));
|
||||
|
||||
// Send the PageLoadPing after every 30 page loads, or on startup.
|
||||
|
||||
@@ -49,6 +49,7 @@ perf:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1892231
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1923894
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1954216
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1949038
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1759744#c5
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1799727#c4
|
||||
@@ -138,6 +139,10 @@ perf:
|
||||
2 - assistive technology in use"
|
||||
type: quantity
|
||||
unit: integer
|
||||
has_ssd:
|
||||
description:
|
||||
"Whether the user has SSD in their hardware or not. Only available on Windows, after startup-idle-tasks are done"
|
||||
type: boolean
|
||||
send_in_pings:
|
||||
- pageload
|
||||
|
||||
|
||||
@@ -2050,7 +2050,7 @@ nsSystemInfo::GetDiskInfo(JSContext* aCx, Promise** aResult) {
|
||||
RefPtr<Promise> capturedPromise = promise;
|
||||
mDiskInfoPromise->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[capturedPromise](const DiskInfo& info) {
|
||||
[capturedPromise, self = RefPtr{this}](const DiskInfo& info) {
|
||||
AutoJSAPI jsapi;
|
||||
if (NS_WARN_IF(!jsapi.Init(capturedPromise->GetGlobalObject()))) {
|
||||
capturedPromise->MaybeReject(NS_ERROR_UNEXPECTED);
|
||||
@@ -2070,6 +2070,10 @@ nsSystemInfo::GetDiskInfo(JSContext* aCx, Promise** aResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool hasSSD =
|
||||
info.binary.isSSD || info.system.isSSD || info.profile.isSSD;
|
||||
self->SetPropertyAsBool(u"hasSSD"_ns, hasSSD);
|
||||
|
||||
JS::Rooted<JS::Value> val(cx, JS::ObjectValue(*jsInfo));
|
||||
capturedPromise->MaybeResolve(val);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user