Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Side by Side Diff: remoting/client/ui/renderer_proxy.cc

Issue 2891603002: [CRD iOS] Trackpad Input Mode (Closed)
Patch Set: Fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/client/ui/input_strategy.h ('k') | remoting/client/ui/trackpad_input_strategy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/client/ui/renderer_proxy.h" 5 #include "remoting/client/ui/renderer_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "remoting/client/display/gl_renderer.h" 9 #include "remoting/client/display/gl_renderer.h"
10 #include "remoting/client/queued_task_poster.h" 10 #include "remoting/client/queued_task_poster.h"
(...skipping 19 matching lines...) Expand all
30 renderer_, transformation.ToMatrixArray()), 30 renderer_, transformation.ToMatrixArray()),
31 true); 31 true);
32 } 32 }
33 33
34 void RendererProxy::SetCursorPosition(float x, float y) { 34 void RendererProxy::SetCursorPosition(float x, float y) {
35 RunTaskOnProperThread(base::Bind(&GlRenderer::OnCursorMoved, renderer_, x, y), 35 RunTaskOnProperThread(base::Bind(&GlRenderer::OnCursorMoved, renderer_, x, y),
36 true); 36 true);
37 } 37 }
38 38
39 void RendererProxy::SetCursorVisibility(bool visible) { 39 void RendererProxy::SetCursorVisibility(bool visible) {
40 // Cursor visibility and position should be synchronized.
40 RunTaskOnProperThread( 41 RunTaskOnProperThread(
41 base::Bind(&GlRenderer::OnCursorVisibilityChanged, renderer_, visible), 42 base::Bind(&GlRenderer::OnCursorVisibilityChanged, renderer_, visible),
42 false); 43 true);
43 } 44 }
44 45
45 void RendererProxy::StartInputFeedback(float x, float y, float diameter) { 46 void RendererProxy::StartInputFeedback(float x, float y, float diameter) {
46 RunTaskOnProperThread( 47 RunTaskOnProperThread(
47 base::Bind(&GlRenderer::OnCursorInputFeedback, renderer_, x, y, diameter), 48 base::Bind(&GlRenderer::OnCursorInputFeedback, renderer_, x, y, diameter),
48 false); 49 false);
49 } 50 }
50 51
51 base::WeakPtr<RendererProxy> RendererProxy::GetWeakPtr() { 52 base::WeakPtr<RendererProxy> RendererProxy::GetWeakPtr() {
52 return weak_factory_.GetWeakPtr(); 53 return weak_factory_.GetWeakPtr();
53 } 54 }
54 55
55 void RendererProxy::RunTaskOnProperThread(const base::Closure& task, 56 void RendererProxy::RunTaskOnProperThread(const base::Closure& task,
56 bool needs_synchronization) { 57 bool needs_synchronization) {
57 if (task_runner_->BelongsToCurrentThread()) { 58 if (task_runner_->BelongsToCurrentThread()) {
58 task.Run(); 59 task.Run();
59 return; 60 return;
60 } 61 }
61 62
62 if (needs_synchronization) { 63 if (needs_synchronization) {
63 ui_task_poster_->AddTask(task); 64 ui_task_poster_->AddTask(task);
64 return; 65 return;
65 } 66 }
66 67
67 task_runner_->PostTask(FROM_HERE, task); 68 task_runner_->PostTask(FROM_HERE, task);
68 } 69 }
69 70
70 } // namespace remoting 71 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/ui/input_strategy.h ('k') | remoting/client/ui/trackpad_input_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698