mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1694505 - Add an optional data path override to FOG init r=janerik
Differential Revision: https://phabricator.services.mozilla.com/D106192
This commit is contained in:
parent
d079588fd9
commit
6932f969a5
@ -34,7 +34,8 @@ void GTest_FOG_ExpectFailure(const char* aMessage) {
|
||||
TEST(FOG, FogInitDoesntCrash)
|
||||
{
|
||||
Preferences::SetInt("telemetry.fog.test.localhost_port", -1);
|
||||
ASSERT_EQ(NS_OK, fog_init());
|
||||
const nsCString empty;
|
||||
ASSERT_EQ(NS_OK, fog_init(&empty));
|
||||
}
|
||||
|
||||
extern "C" void Rust_MeasureInitializeTime();
|
||||
|
@ -49,14 +49,18 @@ use crate::viaduct_uploader::ViaductUploader;
|
||||
/// This assembles client information and the Glean configuration and then initializes the global
|
||||
/// Glean instance.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn fog_init() -> nsresult {
|
||||
pub unsafe extern "C" fn fog_init(data_path_override: &nsACString) -> nsresult {
|
||||
fog::metrics::fog::initialization.start();
|
||||
|
||||
log::debug!("Initializing FOG.");
|
||||
|
||||
let data_path = match get_data_path() {
|
||||
Ok(dp) => dp,
|
||||
Err(e) => return e,
|
||||
let data_path = if data_path_override.is_empty() {
|
||||
match get_data_path() {
|
||||
Ok(dp) => dp,
|
||||
Err(e) => return e,
|
||||
}
|
||||
} else {
|
||||
data_path_override.to_utf8().to_string()
|
||||
};
|
||||
|
||||
let (app_build, app_display_version, channel) = match get_app_info() {
|
||||
|
@ -31,7 +31,9 @@ already_AddRefed<FOG> FOG::GetSingleton() {
|
||||
void FOG::Shutdown() { glean::impl::fog_shutdown(); }
|
||||
|
||||
NS_IMETHODIMP
|
||||
FOG::InitializeFOG() { return glean::impl::fog_init(); }
|
||||
FOG::InitializeFOG(const nsACString& aDataPathOverride) {
|
||||
return glean::impl::fog_init(&aDataPathOverride);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FOG::SetLogPings(bool aEnableLogPings) {
|
||||
|
@ -14,8 +14,11 @@ interface nsIFOG : nsISupports
|
||||
*
|
||||
* To be scheduled at some opportune time after the bulk of Firefox startup
|
||||
* has completed.
|
||||
*
|
||||
* @param aDataPathOverride - The path of a custom Glean data path to use
|
||||
* instead of the profile dir.
|
||||
*/
|
||||
void initializeFOG();
|
||||
void initializeFOG([optional] in AUTF8String aDataPathOverride);
|
||||
|
||||
/**
|
||||
* Enable or Disable the logging of pings in the Glean SDK.
|
||||
|
Loading…
Reference in New Issue
Block a user