From 935511242ab3e4a51b6da01428bfe7e17995b62e Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Thu, 30 Mar 2017 14:09:51 +0200 Subject: [PATCH 1/3] Favor Arc::clone function syntax instead of method syntax in resource_cache.rs. --- webrender/src/resource_cache.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webrender/src/resource_cache.rs b/webrender/src/resource_cache.rs index 27046a9728..ff9e0318a6 100644 --- a/webrender/src/resource_cache.rs +++ b/webrender/src/resource_cache.rs @@ -406,7 +406,7 @@ impl ResourceCache { if !same_epoch && self.blob_image_requests.insert(request) { renderer.request_blob_image( key, - data.clone(), + Arc::clone(&data), &BlobImageDescriptor { width: template.descriptor.width, height: template.descriptor.height, @@ -846,7 +846,7 @@ fn spawn_glyph_cache_thread(workers: Arc>) -> (Sender>) -> (Sender>) -> (Sender Date: Thu, 30 Mar 2017 14:14:25 +0200 Subject: [PATCH 2/3] Favor Arc::clone function syntax instead of method syntax in render_backend.rs and renderer.rs. --- webrender/src/render_backend.rs | 2 +- webrender/src/renderer.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/webrender/src/render_backend.rs b/webrender/src/render_backend.rs index 238399244f..2a60a14c40 100644 --- a/webrender/src/render_backend.rs +++ b/webrender/src/render_backend.rs @@ -309,7 +309,7 @@ impl RenderBackend { if let Some(ref wrapper) = self.webrender_context_handle { let dispatcher: Option> = if cfg!(target_os = "windows") { Some(Box::new(WebRenderGLDispatcher { - dispatcher: self.main_thread_dispatcher.clone() + dispatcher: Arc::clone(&self.main_thread_dispatcher) })) } else { None diff --git a/webrender/src/renderer.rs b/webrender/src/renderer.rs index ada776c124..899f0615da 100644 --- a/webrender/src/renderer.rs +++ b/webrender/src/renderer.rs @@ -589,7 +589,7 @@ impl Renderer { let file_watch_handler = FileWatcher { result_tx: result_tx.clone(), - notifier: notifier.clone(), + notifier: Arc::clone(¬ifier), }; let mut device = Device::new(gl, @@ -857,11 +857,11 @@ impl Renderer { device.end_frame(); let main_thread_dispatcher = Arc::new(Mutex::new(None)); - let backend_notifier = notifier.clone(); - let backend_main_thread_dispatcher = main_thread_dispatcher.clone(); + let backend_notifier = Arc::clone(¬ifier); + let backend_main_thread_dispatcher = Arc::clone(&main_thread_dispatcher); let vr_compositor = Arc::new(Mutex::new(None)); - let backend_vr_compositor = vr_compositor.clone(); + let backend_vr_compositor = Arc::clone(&vr_compositor); // We need a reference to the webrender context from the render backend in order to share // texture ids From 45a2fa8f8a81ca94a7ff23886d128878631e31ca Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Thu, 30 Mar 2017 14:20:12 +0200 Subject: [PATCH 3/3] Favor Rc::clone function syntax instead of method syntax in device.rs. --- webrender/src/device.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/webrender/src/device.rs b/webrender/src/device.rs index fc9c1df50b..b895fd5909 100644 --- a/webrender/src/device.rs +++ b/webrender/src/device.rs @@ -676,10 +676,10 @@ impl GpuProfiler { GpuProfiler { next_frame: 0, frames: [ - GpuFrameProfile::new(gl.clone()), - GpuFrameProfile::new(gl.clone()), - GpuFrameProfile::new(gl.clone()), - GpuFrameProfile::new(gl.clone()), + GpuFrameProfile::new(Rc::clone(&gl)), + GpuFrameProfile::new(Rc::clone(&gl)), + GpuFrameProfile::new(Rc::clone(&gl)), + GpuFrameProfile::new(Rc::clone(&gl)), ], } } @@ -721,12 +721,12 @@ impl GpuMarker { gl::GlType::Gl => { gl.push_group_marker_ext(message); GpuMarker{ - gl: gl.clone(), + gl: Rc::clone(&gl), } } gl::GlType::Gles => { GpuMarker{ - gl: gl.clone(), + gl: Rc::clone(&gl), } } } @@ -1108,7 +1108,7 @@ impl Device { }; let texture = Texture { - gl: self.gl.clone(), + gl: Rc::clone(&self.gl), id: id, width: 0, height: 0, @@ -1451,7 +1451,7 @@ impl Device { } let program = Program { - gl: self.gl.clone(), + gl: Rc::clone(&self.gl), name: base_filename.to_owned(), id: pid, u_transform: -1, @@ -1795,7 +1795,7 @@ impl Device { ibo_id.bind(self.gl()); // force it to be a part of VAO let vao = VAO { - gl: self.gl.clone(), + gl: Rc::clone(&self.gl), id: vao_id, ibo_id: ibo_id, main_vbo_id: main_vbo_id,