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

Unified Diff: remoting/client/renderer_facade_proxy.cc

Issue 2879743002: [CRD iOS] Hook the touch input feedback (Closed)
Patch Set: Just use ViewMatrix::Point. No more out-pointers... 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/renderer_facade_proxy.cc
diff --git a/remoting/client/renderer_facade_proxy.cc b/remoting/client/renderer_facade_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a40b56de33535b04ac80c626b36962b86d8f6fb5
--- /dev/null
+++ b/remoting/client/renderer_facade_proxy.cc
@@ -0,0 +1,61 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/client/renderer_facade_proxy.h"
+
+#include "base/bind.h"
+#include "remoting/client/queued_task_poster.h"
+#include "remoting/client/view_matrix.h"
+
+namespace remoting {
+
+RendererFacadeProxy::RendererFacadeProxy(
+ base::WeakPtr<RendererFacade> renderer,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : renderer_(renderer),
+ task_runner_(task_runner),
+ ui_task_poster_(new remoting::QueuedTaskPoster(task_runner_)) {}
+
+RendererFacadeProxy::~RendererFacadeProxy() {}
+
+void RendererFacadeProxy::SetTransformation(const ViewMatrix& transformation) {
+ // Viewport and cursor movements need to be synchronized into the same frame.
+ RunTaskOnProperThread(
+ base::Bind(&RendererFacade::SetTransformation, renderer_, transformation),
+ true);
+}
+
+void RendererFacadeProxy::SetCursorPosition(float x, float y) {
+ RunTaskOnProperThread(
+ base::Bind(&RendererFacade::SetCursorPosition, renderer_, x, y), true);
+}
+
+void RendererFacadeProxy::SetCursorVisibility(bool visible) {
+ RunTaskOnProperThread(
+ base::Bind(&RendererFacade::SetCursorVisibility, renderer_, visible),
+ false);
+}
+
+void RendererFacadeProxy::StartInputFeedback(float x, float y, float diameter) {
+ RunTaskOnProperThread(base::Bind(&RendererFacade::StartInputFeedback,
+ renderer_, x, y, diameter),
+ false);
+}
+
+void RendererFacadeProxy::RunTaskOnProperThread(const base::Closure& task,
+ bool needs_synchronization) {
+ if (task_runner_->BelongsToCurrentThread()) {
+ task.Run();
+ return;
+ }
+
+ if (needs_synchronization) {
+ ui_task_poster_->AddTask(task);
+ return;
+ }
+
+ task_runner_->PostTask(FROM_HERE, task);
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698