mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Stop wrapping FileManager in an Arc.
It already contains an Arc internally.
This commit is contained in:
parent
53b6343f3c
commit
d820387758
3 changed files with 13 additions and 4 deletions
|
@ -23,7 +23,7 @@ use util::thread::spawn_named;
|
|||
// TODO: Check on GET
|
||||
// https://w3c.github.io/FileAPI/#requestResponseModel
|
||||
|
||||
pub fn factory<UI: 'static + UIProvider>(filemanager: Arc<FileManager<UI>>)
|
||||
pub fn factory<UI: 'static + UIProvider>(filemanager: FileManager<UI>)
|
||||
-> Box<FnBox(LoadData, LoadConsumer, Arc<MimeClassifier>, CancellationListener) + Send> {
|
||||
box move |load_data: LoadData, start_chan, classifier, cancel_listener| {
|
||||
spawn_named(format!("blob loader for {}", load_data.url), move || {
|
||||
|
@ -35,7 +35,7 @@ pub fn factory<UI: 'static + UIProvider>(filemanager: Arc<FileManager<UI>>)
|
|||
fn load_blob<UI: 'static + UIProvider>
|
||||
(load_data: LoadData, start_chan: LoadConsumer,
|
||||
classifier: Arc<MimeClassifier>,
|
||||
filemanager: Arc<FileManager<UI>>,
|
||||
filemanager: FileManager<UI>,
|
||||
cancel_listener: CancellationListener) {
|
||||
let (chan, recv) = ipc::channel().unwrap();
|
||||
if let Ok((id, origin, _fragment)) = parse_blob_url(&load_data.url.clone()) {
|
||||
|
|
|
@ -116,6 +116,15 @@ pub struct FileManager<UI: 'static + UIProvider> {
|
|||
store: Arc<FileManagerStore<UI>>,
|
||||
}
|
||||
|
||||
// Not derived to avoid an unnecessary `UI: Clone` bound.
|
||||
impl<UI: 'static + UIProvider> Clone for FileManager<UI> {
|
||||
fn clone(&self) -> Self {
|
||||
FileManager {
|
||||
store: self.store.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<UI: 'static + UIProvider> FileManager<UI> {
|
||||
pub fn new(ui: &'static UI) -> FileManager<UI> {
|
||||
FileManager {
|
||||
|
|
|
@ -475,7 +475,7 @@ pub struct CoreResourceManager {
|
|||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
swmanager_chan: Option<IpcSender<CustomResponseMediator>>,
|
||||
profiler_chan: ProfilerChan,
|
||||
filemanager: Arc<FileManager<TFDProvider>>,
|
||||
filemanager: FileManager<TFDProvider>,
|
||||
cancel_load_map: HashMap<ResourceId, Sender<()>>,
|
||||
next_resource_id: ResourceId,
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ impl CoreResourceManager {
|
|||
devtools_chan: devtools_channel,
|
||||
swmanager_chan: None,
|
||||
profiler_chan: profiler_chan,
|
||||
filemanager: Arc::new(FileManager::new(TFD_PROVIDER)),
|
||||
filemanager: FileManager::new(TFD_PROVIDER),
|
||||
cancel_load_map: HashMap::new(),
|
||||
next_resource_id: ResourceId(0),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue