Skip to content

Commit

Permalink
Bug 1816190 - Instrument FOG for experimentation on early shutdown pi…
Browse files Browse the repository at this point in the history
…ngs r=chutten

Differential Revision: https://phabricator.services.mozilla.com/D171270
  • Loading branch information
travis79 committed Mar 3, 2023
1 parent cb931df commit fa145a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions toolkit/components/glean/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,11 @@ pub extern "C" fn fog_set_metrics_feature_config(config_json: &nsACString) {
}
glean::glean_set_metrics_disabled_config(config_json.to_string());
}

/// Performs Glean tasks when client state changes to inactive
///
/// See [`glean_core::Glean::handle_client_inactive`].
#[no_mangle]
pub extern "C" fn fog_internal_glean_handle_client_inactive() {
glean::handle_client_inactive();
}
9 changes: 9 additions & 0 deletions toolkit/components/glean/xpcom/FOG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/FOGIPC.h"
#include "mozilla/browser/NimbusFeatures.h"
#include "mozilla/glean/bindings/Common.h"
#include "mozilla/glean/bindings/jog/jog_ffi_generated.h"
#include "mozilla/glean/fog_ffi_generated.h"
Expand Down Expand Up @@ -92,6 +93,14 @@ NS_IMETHODIMP
FOG::InitializeFOG(const nsACString& aDataPathOverride,
const nsACString& aAppIdOverride) {
MOZ_ASSERT(XRE_IsParentProcess());
RunOnShutdown(
[&] {
if (NimbusFeatures::GetBool("glean"_ns, "finalInactive"_ns, false)) {
glean::impl::fog_internal_glean_handle_client_inactive();
}
},
ShutdownPhase::XPCOMWillShutdown);

return glean::impl::fog_init(&aDataPathOverride, &aAppIdOverride);
}

Expand Down
3 changes: 3 additions & 0 deletions toolkit/components/nimbus/FeatureManifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ glean:
owner: [email protected]
hasExposure: false
variables:
finalInactive:
type: "boolean"
description: "Enables FOG early shutdown pings when true"
newtabPingEnabled:
type: "boolean"
fallbackPref: "browser.newtabpage.ping.enabled"
Expand Down

0 comments on commit fa145a3

Please sign in to comment.