| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/mouse_shape_pump.h" | 5 #include "remoting/host/mouse_shape_pump.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(Core); | 47 DISALLOW_COPY_AND_ASSIGN(Core); |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 MouseShapePump::Core::Core( | 50 MouseShapePump::Core::Core( |
| 51 base::WeakPtr<MouseShapePump> proxy, | 51 base::WeakPtr<MouseShapePump> proxy, |
| 52 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 52 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 53 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor) | 53 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor) |
| 54 : proxy_(proxy), | 54 : proxy_(proxy), |
| 55 caller_task_runner_(caller_task_runner), | 55 caller_task_runner_(caller_task_runner), |
| 56 mouse_cursor_monitor_(mouse_cursor_monitor.Pass()), | 56 mouse_cursor_monitor_(std::move(mouse_cursor_monitor)), |
| 57 capture_timer_(true, true) { | 57 capture_timer_(true, true) { |
| 58 thread_checker_.DetachFromThread(); | 58 thread_checker_.DetachFromThread(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 MouseShapePump::Core::~Core() { | 61 MouseShapePump::Core::~Core() { |
| 62 DCHECK(thread_checker_.CalledOnValidThread()); | 62 DCHECK(thread_checker_.CalledOnValidThread()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void MouseShapePump::Core::Start() { | 65 void MouseShapePump::Core::Start() { |
| 66 DCHECK(thread_checker_.CalledOnValidThread()); | 66 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 MouseShapePump::MouseShapePump( | 115 MouseShapePump::MouseShapePump( |
| 116 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 116 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
| 117 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, | 117 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, |
| 118 protocol::CursorShapeStub* cursor_shape_stub) | 118 protocol::CursorShapeStub* cursor_shape_stub) |
| 119 : capture_task_runner_(capture_task_runner), | 119 : capture_task_runner_(capture_task_runner), |
| 120 cursor_shape_stub_(cursor_shape_stub), | 120 cursor_shape_stub_(cursor_shape_stub), |
| 121 weak_factory_(this) { | 121 weak_factory_(this) { |
| 122 core_.reset(new Core(weak_factory_.GetWeakPtr(), | 122 core_.reset(new Core(weak_factory_.GetWeakPtr(), |
| 123 base::ThreadTaskRunnerHandle::Get(), | 123 base::ThreadTaskRunnerHandle::Get(), |
| 124 mouse_cursor_monitor.Pass())); | 124 std::move(mouse_cursor_monitor))); |
| 125 capture_task_runner_->PostTask( | 125 capture_task_runner_->PostTask( |
| 126 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); | 126 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); |
| 127 } | 127 } |
| 128 | 128 |
| 129 MouseShapePump::~MouseShapePump() { | 129 MouseShapePump::~MouseShapePump() { |
| 130 capture_task_runner_->DeleteSoon(FROM_HERE, core_.release()); | 130 capture_task_runner_->DeleteSoon(FROM_HERE, core_.release()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void MouseShapePump::OnCursorShape( | 133 void MouseShapePump::OnCursorShape( |
| 134 scoped_ptr<protocol::CursorShapeInfo> cursor) { | 134 scoped_ptr<protocol::CursorShapeInfo> cursor) { |
| 135 DCHECK(thread_checker_.CalledOnValidThread()); | 135 DCHECK(thread_checker_.CalledOnValidThread()); |
| 136 | 136 |
| 137 cursor_shape_stub_->SetCursorShape(*cursor); | 137 cursor_shape_stub_->SetCursorShape(*cursor); |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace remoting | 140 } // namespace remoting |
| OLD | NEW |