mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +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
|
// TODO: Check on GET
|
||||||
// https://w3c.github.io/FileAPI/#requestResponseModel
|
// 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<FnBox(LoadData, LoadConsumer, Arc<MimeClassifier>, CancellationListener) + Send> {
|
||||||
box move |load_data: LoadData, start_chan, classifier, cancel_listener| {
|
box move |load_data: LoadData, start_chan, classifier, cancel_listener| {
|
||||||
spawn_named(format!("blob loader for {}", load_data.url), move || {
|
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>
|
fn load_blob<UI: 'static + UIProvider>
|
||||||
(load_data: LoadData, start_chan: LoadConsumer,
|
(load_data: LoadData, start_chan: LoadConsumer,
|
||||||
classifier: Arc<MimeClassifier>,
|
classifier: Arc<MimeClassifier>,
|
||||||
filemanager: Arc<FileManager<UI>>,
|
filemanager: FileManager<UI>,
|
||||||
cancel_listener: CancellationListener) {
|
cancel_listener: CancellationListener) {
|
||||||
let (chan, recv) = ipc::channel().unwrap();
|
let (chan, recv) = ipc::channel().unwrap();
|
||||||
if let Ok((id, origin, _fragment)) = parse_blob_url(&load_data.url.clone()) {
|
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>>,
|
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> {
|
impl<UI: 'static + UIProvider> FileManager<UI> {
|
||||||
pub fn new(ui: &'static UI) -> FileManager<UI> {
|
pub fn new(ui: &'static UI) -> FileManager<UI> {
|
||||||
FileManager {
|
FileManager {
|
||||||
|
|
|
@ -475,7 +475,7 @@ pub struct CoreResourceManager {
|
||||||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||||
swmanager_chan: Option<IpcSender<CustomResponseMediator>>,
|
swmanager_chan: Option<IpcSender<CustomResponseMediator>>,
|
||||||
profiler_chan: ProfilerChan,
|
profiler_chan: ProfilerChan,
|
||||||
filemanager: Arc<FileManager<TFDProvider>>,
|
filemanager: FileManager<TFDProvider>,
|
||||||
cancel_load_map: HashMap<ResourceId, Sender<()>>,
|
cancel_load_map: HashMap<ResourceId, Sender<()>>,
|
||||||
next_resource_id: ResourceId,
|
next_resource_id: ResourceId,
|
||||||
}
|
}
|
||||||
|
@ -490,7 +490,7 @@ impl CoreResourceManager {
|
||||||
devtools_chan: devtools_channel,
|
devtools_chan: devtools_channel,
|
||||||
swmanager_chan: None,
|
swmanager_chan: None,
|
||||||
profiler_chan: profiler_chan,
|
profiler_chan: profiler_chan,
|
||||||
filemanager: Arc::new(FileManager::new(TFD_PROVIDER)),
|
filemanager: FileManager::new(TFD_PROVIDER),
|
||||||
cancel_load_map: HashMap::new(),
|
cancel_load_map: HashMap::new(),
|
||||||
next_resource_id: ResourceId(0),
|
next_resource_id: ResourceId(0),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue