aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/filemanager_thread.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-10-13 14:09:06 +0200
committerMs2ger <Ms2ger@gmail.com>2016-10-14 11:30:10 +0200
commitc513b5f2266c032040d615812fba463b053ee5b5 (patch)
tree44c338974007fa33c2f7113519ada90569e03201 /components/net/filemanager_thread.rs
parentfc68e0a6caa43b1f91194a5101644fa26dd7bd72 (diff)
downloadservo-c513b5f2266c032040d615812fba463b053ee5b5.tar.gz
servo-c513b5f2266c032040d615812fba463b053ee5b5.zip
Avoid an unnecessary clone when calling FileManagerStore::try_read_file.
Diffstat (limited to 'components/net/filemanager_thread.rs')
-rw-r--r--components/net/filemanager_thread.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/components/net/filemanager_thread.rs b/components/net/filemanager_thread.rs
index d682ea02569..567d2f18740 100644
--- a/components/net/filemanager_thread.rs
+++ b/components/net/filemanager_thread.rs
@@ -148,7 +148,7 @@ impl<UI: 'static + UIProvider> FileManager<UI> {
}
FileManagerThreadMsg::ReadFile(sender, id, check_url_validity, origin) => {
spawn_named("read file".to_owned(), move || {
- if let Err(e) = store.try_read_file(sender.clone(), id, check_url_validity,
+ if let Err(e) = store.try_read_file(&sender, id, check_url_validity,
origin, cancel_listener) {
let _ = sender.send(Err(FileManagerThreadError::BlobURLStoreError(e)));
}
@@ -374,7 +374,7 @@ impl <UI: 'static + UIProvider> FileManagerStore<UI> {
})
}
- fn get_blob_buf(&self, sender: IpcSender<FileManagerResult<ReadFileProgress>>,
+ fn get_blob_buf(&self, sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
id: &Uuid, origin_in: &FileOrigin, rel_pos: RelativePos,
check_url_validity: bool,
cancel_listener: Option<CancellationListener>) -> Result<(), BlobURLStoreError> {
@@ -437,7 +437,7 @@ impl <UI: 'static + UIProvider> FileManagerStore<UI> {
}
// Convenient wrapper over get_blob_buf
- fn try_read_file(&self, sender: IpcSender<FileManagerResult<ReadFileProgress>>,
+ fn try_read_file(&self, sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
id: Uuid, check_url_validity: bool, origin_in: FileOrigin,
cancel_listener: Option<CancellationListener>) -> Result<(), BlobURLStoreError> {
self.get_blob_buf(sender, &id, &origin_in, RelativePos::full_range(), check_url_validity, cancel_listener)
@@ -550,7 +550,7 @@ fn select_files_pref_enabled() -> bool {
const CHUNK_SIZE: usize = 8192;
-fn chunked_read(sender: IpcSender<FileManagerResult<ReadFileProgress>>,
+fn chunked_read(sender: &IpcSender<FileManagerResult<ReadFileProgress>>,
file: &mut File, size: usize, opt_filename: Option<String>,
type_string: String, cancel_listener: Option<CancellationListener>) {
// First chunk