mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1623304 - Ensure Viaduct is initialized for FOG r=janerik
Differential Revision: https://phabricator.services.mozilla.com/D76747
This commit is contained in:
parent
98df40a194
commit
4cbf614d9e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1481,6 +1481,7 @@ checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||
name = "fog"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cstr",
|
||||
"glean",
|
||||
"glean-core",
|
||||
"log",
|
||||
|
@ -14,3 +14,4 @@ static_prefs = { path = "../../../modules/libpref/init/static_prefs" }
|
||||
xpcom = { path = "../../../xpcom/rust/xpcom" }
|
||||
once_cell = "1.2.0"
|
||||
glean = { path = "./api" }
|
||||
cstr = "0.1"
|
||||
|
@ -21,11 +21,15 @@
|
||||
// compiled.
|
||||
pub extern crate glean;
|
||||
|
||||
#[macro_use]
|
||||
extern crate cstr;
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
use nserror::{nsresult, NS_OK};
|
||||
use nsstring::nsACString;
|
||||
use xpcom::interfaces::mozIViaduct;
|
||||
|
||||
use client_info::ClientInfo;
|
||||
use glean_core::Configuration;
|
||||
@ -79,6 +83,19 @@ pub unsafe extern "C" fn fog_init(
|
||||
|
||||
log::debug!("Configuration: {:#?}", configuration);
|
||||
|
||||
// Ensure Viaduct is initialized for networking unconditionally so we don't
|
||||
// need to check again if upload is later enabled.
|
||||
if let Some(viaduct) =
|
||||
xpcom::create_instance::<mozIViaduct>(cstr!("@mozilla.org/toolkit/viaduct;1"))
|
||||
{
|
||||
let result = viaduct.EnsureInitialized();
|
||||
if result.failed() {
|
||||
log::error!("Failed to ensure viaduct was initialized due to {}. Ping upload may not be available.", result.error_name());
|
||||
}
|
||||
} else {
|
||||
log::error!("Failed to create Viaduct via XPCOM. Ping upload may not be available.");
|
||||
}
|
||||
|
||||
if configuration.data_path.len() > 0 {
|
||||
if let Err(e) = api::initialize(configuration, client_info) {
|
||||
log::error!("Failed to init FOG due to {:?}", e);
|
||||
|
Loading…
Reference in New Issue
Block a user