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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/location.h" | 12 #include "base/location.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
14 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
15 #include "remoting/proto/control.pb.h" | 17 #include "remoting/proto/control.pb.h" |
16 #include "remoting/protocol/cursor_shape_stub.h" | 18 #include "remoting/protocol/cursor_shape_stub.h" |
17 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 19 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
18 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" | 20 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" |
(...skipping 30 matching lines...) Expand all Loading... |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(Core); | 52 DISALLOW_COPY_AND_ASSIGN(Core); |
51 }; | 53 }; |
52 | 54 |
53 MouseShapePump::Core::Core( | 55 MouseShapePump::Core::Core( |
54 base::WeakPtr<MouseShapePump> proxy, | 56 base::WeakPtr<MouseShapePump> proxy, |
55 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 57 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
56 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor) | 58 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor) |
57 : proxy_(proxy), | 59 : proxy_(proxy), |
58 caller_task_runner_(caller_task_runner), | 60 caller_task_runner_(caller_task_runner), |
59 mouse_cursor_monitor_(mouse_cursor_monitor.Pass()), | 61 mouse_cursor_monitor_(std::move(mouse_cursor_monitor)), |
60 capture_timer_(true, true) { | 62 capture_timer_(true, true) { |
61 thread_checker_.DetachFromThread(); | 63 thread_checker_.DetachFromThread(); |
62 } | 64 } |
63 | 65 |
64 MouseShapePump::Core::~Core() { | 66 MouseShapePump::Core::~Core() { |
65 DCHECK(thread_checker_.CalledOnValidThread()); | 67 DCHECK(thread_checker_.CalledOnValidThread()); |
66 } | 68 } |
67 | 69 |
68 void MouseShapePump::Core::Start() { | 70 void MouseShapePump::Core::Start() { |
69 DCHECK(thread_checker_.CalledOnValidThread()); | 71 DCHECK(thread_checker_.CalledOnValidThread()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 119 |
118 MouseShapePump::MouseShapePump( | 120 MouseShapePump::MouseShapePump( |
119 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 121 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
120 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, | 122 scoped_ptr<webrtc::MouseCursorMonitor> mouse_cursor_monitor, |
121 protocol::CursorShapeStub* cursor_shape_stub) | 123 protocol::CursorShapeStub* cursor_shape_stub) |
122 : capture_task_runner_(capture_task_runner), | 124 : capture_task_runner_(capture_task_runner), |
123 cursor_shape_stub_(cursor_shape_stub), | 125 cursor_shape_stub_(cursor_shape_stub), |
124 weak_factory_(this) { | 126 weak_factory_(this) { |
125 core_.reset(new Core(weak_factory_.GetWeakPtr(), | 127 core_.reset(new Core(weak_factory_.GetWeakPtr(), |
126 base::ThreadTaskRunnerHandle::Get(), | 128 base::ThreadTaskRunnerHandle::Get(), |
127 mouse_cursor_monitor.Pass())); | 129 std::move(mouse_cursor_monitor))); |
128 capture_task_runner_->PostTask( | 130 capture_task_runner_->PostTask( |
129 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); | 131 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); |
130 } | 132 } |
131 | 133 |
132 MouseShapePump::~MouseShapePump() { | 134 MouseShapePump::~MouseShapePump() { |
133 capture_task_runner_->DeleteSoon(FROM_HERE, core_.release()); | 135 capture_task_runner_->DeleteSoon(FROM_HERE, core_.release()); |
134 } | 136 } |
135 | 137 |
136 void MouseShapePump::OnCursorShape( | 138 void MouseShapePump::OnCursorShape( |
137 scoped_ptr<protocol::CursorShapeInfo> cursor) { | 139 scoped_ptr<protocol::CursorShapeInfo> cursor) { |
138 DCHECK(thread_checker_.CalledOnValidThread()); | 140 DCHECK(thread_checker_.CalledOnValidThread()); |
139 | 141 |
140 cursor_shape_stub_->SetCursorShape(*cursor); | 142 cursor_shape_stub_->SetCursorShape(*cursor); |
141 } | 143 } |
142 | 144 |
143 } // namespace remoting | 145 } // namespace remoting |
OLD | NEW |