Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favor the function over the method syntax when cloning a reference counted pointer. #1037

Merged
merged 3 commits into from
Apr 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions webrender/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,10 @@ impl<T> GpuProfiler<T> {
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)),
],
}
}
Expand Down Expand Up @@ -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),
}
}
}
Expand Down Expand Up @@ -1108,7 +1108,7 @@ impl Device {
};

let texture = Texture {
gl: self.gl.clone(),
gl: Rc::clone(&self.gl),
id: id,
width: 0,
height: 0,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion webrender/src/render_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl RenderBackend {
if let Some(ref wrapper) = self.webrender_context_handle {
let dispatcher: Option<Box<GLContextDispatcher>> = if cfg!(target_os = "windows") {
Some(Box::new(WebRenderGLDispatcher {
dispatcher: self.main_thread_dispatcher.clone()
dispatcher: Arc::clone(&self.main_thread_dispatcher)
}))
} else {
None
Expand Down
8 changes: 4 additions & 4 deletions webrender/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ impl Renderer {

let file_watch_handler = FileWatcher {
result_tx: result_tx.clone(),
notifier: notifier.clone(),
notifier: Arc::clone(&notifier),
};

let mut device = Device::new(gl,
Expand Down Expand Up @@ -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(&notifier);
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
Expand Down
8 changes: 4 additions & 4 deletions webrender/src/resource_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -846,7 +846,7 @@ fn spawn_glyph_cache_thread(workers: Arc<Mutex<ThreadPool>>) -> (Sender<GlyphCac

let barrier = Arc::new(Barrier::new(worker_count));
for i in 0..worker_count {
let barrier = barrier.clone();
let barrier = Arc::clone(&barrier);
workers.lock().unwrap().execute(move || {
register_thread_with_profiler(format!("Glyph Worker {}", i));
barrier.wait();
Expand Down Expand Up @@ -882,7 +882,7 @@ fn spawn_glyph_cache_thread(workers: Arc<Mutex<ThreadPool>>) -> (Sender<GlyphCac
// added to each worker thread.
let barrier = Arc::new(Barrier::new(worker_count));
for _ in 0..worker_count {
let barrier = barrier.clone();
let barrier = Arc::clone(&barrier);
let font_template = font_template.clone();
workers.lock().unwrap().execute(move || {
FONT_CONTEXT.with(|font_context| {
Expand All @@ -908,7 +908,7 @@ fn spawn_glyph_cache_thread(workers: Arc<Mutex<ThreadPool>>) -> (Sender<GlyphCac
// Delete a font from the font context in each worker thread.
let barrier = Arc::new(Barrier::new(worker_count));
for _ in 0..worker_count {
let barrier = barrier.clone();
let barrier = Arc::clone(&barrier);
workers.lock().unwrap().execute(move || {
FONT_CONTEXT.with(|font_context| {
let mut font_context = font_context.borrow_mut();
Expand Down