Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/places/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use glean_build::Builder;
fn main() {
uniffi::generate_scaffolding("./src/places.udl").unwrap();

if let Ok("android") = std::env::var("CARGO_CFG_TARGET_OS")
if let Ok("android" | "ios") = std::env::var("CARGO_CFG_TARGET_OS")
.as_ref()
.map(String::as_str)
{
Expand Down
20 changes: 10 additions & 10 deletions components/places/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::api::matcher::{self, search_frecent, SearchParams};
pub use crate::api::places_api::places_api_new;
pub use crate::error::{warn, Result};
pub use crate::error::{ApiResult, PlacesApiError};
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
use crate::glean_metrics::places_manager;
pub use crate::import::common::HistoryMigrationResult;
use crate::import::import_ios_history;
Expand Down Expand Up @@ -113,7 +113,7 @@ pub struct PlacesConnection {

impl PlacesConnection {
pub fn new(db: PlacesDb) -> Self {
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
places_manager::connection_initialized.add(1);

Self {
Expand Down Expand Up @@ -389,48 +389,48 @@ impl PlacesConnection {
db_size_limit: u32,
prune_limit: u32,
) -> ApiResult<RunMaintenanceMetrics> {
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
let timer_id = places_manager::run_maintenance_prune_time_temp.start();
let res =
self.with_conn(|conn| storage::run_maintenance_prune(conn, db_size_limit, prune_limit));

#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
places_manager::run_maintenance_prune_time_temp.stop_and_accumulate(timer_id);

res
}

#[handle_error(crate::Error)]
pub fn run_maintenance_vacuum(&self) -> ApiResult<()> {
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
let timer_id = places_manager::run_maintenance_vacuum_time_temp.start();
let res = self.with_conn(storage::run_maintenance_vacuum);

#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
places_manager::run_maintenance_vacuum_time_temp.stop_and_accumulate(timer_id);

res
}

#[handle_error(crate::Error)]
pub fn run_maintenance_optimize(&self) -> ApiResult<()> {
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
let timer_id = places_manager::run_maintenance_optimize_time_temp.start();
let res = self.with_conn(storage::run_maintenance_optimize);

#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
places_manager::run_maintenance_optimize_time_temp.stop_and_accumulate(timer_id);

res
}

#[handle_error(crate::Error)]
pub fn run_maintenance_checkpoint(&self) -> ApiResult<()> {
#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
let timer_id = places_manager::run_maintenance_chk_pnt_time_temp.start();
let res = self.with_conn(storage::run_maintenance_checkpoint);

#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
places_manager::run_maintenance_chk_pnt_time_temp.stop_and_accumulate(timer_id);

res
Expand Down
2 changes: 1 addition & 1 deletion components/places/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub use crate::types::*;

pub use ffi::*;

#[cfg(all(feature = "glean-sym", target_os = "android"))]
#[cfg(all(feature = "glean-sym", any(target_os = "android", target_os = "ios")))]
#[allow(clippy::all)] // Don't lint generated code.
pub mod glean_metrics {
include!(concat!(env!("OUT_DIR"), "/glean_metrics.rs"));
Expand Down