mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00
Bug 1879154: Add code to (potentially) submit the ping during idle r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D200996
This commit is contained in:
parent
9966a1e5f7
commit
3d447e5431
@ -71,6 +71,7 @@
|
||||
#include "nsTLiteralString.h"
|
||||
#include "nsTPromiseFlatString.h"
|
||||
#include "nsTStringRepr.h"
|
||||
#include "nsUserCharacteristics.h"
|
||||
#include "nsXPCOM.h"
|
||||
|
||||
#include "nsICookieJarSettings.h"
|
||||
@ -106,6 +107,7 @@ static mozilla::LazyLogModule gFingerprinterDetection("FingerprinterDetection");
|
||||
|
||||
#define RFP_TIMER_UNCONDITIONAL_VALUE 20
|
||||
#define LAST_PB_SESSION_EXITED_TOPIC "last-pb-context-exited"
|
||||
#define IDLE_TOPIC "browser-idle-startup-tasks-finished"
|
||||
|
||||
static constexpr uint32_t kVideoFramesPerSec = 30;
|
||||
static constexpr uint32_t kVideoDroppedRatio = 5;
|
||||
@ -181,6 +183,9 @@ nsresult nsRFPService::Init() {
|
||||
|
||||
rv = obs->AddObserver(this, OBSERVER_TOPIC_IDLE_DAILY, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = obs->AddObserver(this, IDLE_TOPIC, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
Preferences::RegisterCallbacks(nsRFPService::PrefChanged, gCallbackPrefs,
|
||||
@ -278,6 +283,7 @@ void nsRFPService::StartShutdown() {
|
||||
if (XRE_IsParentProcess()) {
|
||||
obs->RemoveObserver(this, LAST_PB_SESSION_EXITED_TOPIC);
|
||||
obs->RemoveObserver(this, OBSERVER_TOPIC_IDLE_DAILY);
|
||||
obs->RemoveObserver(this, IDLE_TOPIC);
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,6 +334,10 @@ nsRFPService::Observe(nsISupports* aObject, const char* aTopic,
|
||||
ClearBrowsingSessionKey(pattern);
|
||||
}
|
||||
|
||||
if (!strcmp(IDLE_TOPIC, aTopic)) {
|
||||
nsUserCharacteristics::MaybeSubmitPing();
|
||||
}
|
||||
|
||||
if (!strcmp(OBSERVER_TOPIC_IDLE_DAILY, aTopic)) {
|
||||
if (StaticPrefs::
|
||||
privacy_resistFingerprinting_randomization_daily_reset_enabled()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user