agentmux_cef\commands/
mod.rs1pub mod platform;
8pub mod window;
9pub mod backend;
10pub mod providers;
11pub mod drag;
12pub mod tear_off_hook;
13pub mod window_pool;
14pub mod clipboard;
15pub mod stubs;
16pub mod palette;
17pub mod orphan_reconcile;
18pub mod floating_pane;
19
20use std::sync::Arc;
21use crate::state::AppState;
22
23pub fn create_isolated_request_context(state: &Arc<AppState>, label: &str) -> Option<cef::RequestContext> {
30 let t0 = std::time::Instant::now();
36 tracing::info!(label = %label, "[cef-profile-init] entering create_isolated_request_context");
37
38 let data_dir = state.version_data_dir.lock().clone()
39 .unwrap_or_else(|| {
40 std::env::temp_dir()
41 .join("agentmux-cef-contexts")
42 .to_string_lossy()
43 .to_string()
44 });
45
46 let ctx_path = std::path::PathBuf::from(&data_dir)
47 .join("browser-contexts")
48 .join(label);
49 let settings = cef::RequestContextSettings {
54 cache_path: cef::CefString::from(ctx_path.to_str().unwrap_or("")),
55 persist_session_cookies: 0,
56 ..Default::default()
57 };
58
59 tracing::info!(
60 label = %label,
61 elapsed_us = t0.elapsed().as_micros() as u64,
62 "[cef-profile-init] calling request_context_create_context"
63 );
64 let ctx = cef::request_context_create_context(Some(&settings), None);
65 tracing::info!(
66 label = %label,
67 elapsed_us = t0.elapsed().as_micros() as u64,
68 ok = ctx.is_some(),
69 "[cef-profile-init] request_context_create_context returned"
70 );
71
72 if ctx.is_some() {
73 tracing::info!(label = %label, path = %ctx_path.display(), "[cef] created isolated RequestContext");
74 } else {
75 tracing::warn!(label = %label, "[cef] failed to create isolated RequestContext — falling back to shared");
76 }
77 ctx
78}