Record local diagnostics events
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
use std::time::SystemTime;
|
||||
|
||||
use ely_domain::{DiagnosticEvent, DiagnosticEventKind};
|
||||
|
||||
use super::BrowserCore;
|
||||
|
||||
impl BrowserCore {
|
||||
pub fn record_diagnostic_event(&mut self, kind: DiagnosticEventKind) {
|
||||
self.diagnostic_events.push(DiagnosticEvent::new(kind, SystemTime::now()));
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn diagnostic_events(&self) -> &[DiagnosticEvent] {
|
||||
&self.diagnostic_events
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
use ely_domain::{DiagnosticsReportingPolicy, HistoryRecordingPolicy};
|
||||
|
||||
use super::BrowserCore;
|
||||
|
||||
impl BrowserCore {
|
||||
pub fn set_history_recording_policy(&mut self, policy: HistoryRecordingPolicy) {
|
||||
self.history_recording_policy = policy;
|
||||
}
|
||||
|
||||
pub fn set_diagnostics_reporting_policy(&mut self, policy: DiagnosticsReportingPolicy) {
|
||||
self.diagnostics_reporting_policy = policy;
|
||||
}
|
||||
|
||||
pub fn reset_privacy_settings(&mut self) {
|
||||
self.set_history_recording_policy(HistoryRecordingPolicy::default());
|
||||
self.set_diagnostics_reporting_policy(DiagnosticsReportingPolicy::default());
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn history_recording_policy(&self) -> HistoryRecordingPolicy {
|
||||
self.history_recording_policy
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn diagnostics_reporting_policy(&self) -> DiagnosticsReportingPolicy {
|
||||
self.diagnostics_reporting_policy
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::time::SystemTime;
|
||||
|
||||
use ely_domain::TabId;
|
||||
use ely_domain::{DiagnosticEventKind, TabId, WebViewCrashKind};
|
||||
|
||||
use super::BrowserCore;
|
||||
use crate::CoreError;
|
||||
@@ -18,6 +18,9 @@ impl BrowserCore {
|
||||
.find(|tab| tab.id() == tab_id)
|
||||
.ok_or_else(|| CoreError::TabNotFound { id: tab_id.clone() })?;
|
||||
tab.mark_crashed();
|
||||
self.record_diagnostic_event(DiagnosticEventKind::WebViewCrash {
|
||||
crash_kind: WebViewCrashKind::TabCrashed,
|
||||
});
|
||||
Ok(tab_id.clone())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user