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

Unified Diff: remoting/android/java/src/org/chromium/chromoting/RenderController.java

Issue 2322623002: [Remoting Android] Refactor GlDesktopView (Closed)
Patch Set: Add RenderController Created 4 years, 3 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/android/java/src/org/chromium/chromoting/RenderController.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/RenderController.java b/remoting/android/java/src/org/chromium/chromoting/RenderController.java
new file mode 100644
index 0000000000000000000000000000000000000000..ede79665fd6d47bc680b9028741bd3e21c4e4b68
--- /dev/null
+++ b/remoting/android/java/src/org/chromium/chromoting/RenderController.java
@@ -0,0 +1,50 @@
+// Copyright 2016 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.
+
+package org.chromium.chromoting;
+
+import org.chromium.chromoting.jni.Client;
+
+/**
+ * This class manages resources related to the rendering process. Its lifetime should be the same
+ * as the JNI client.
+ */
+public class RenderController {
Hzj_jie 2016/09/08 21:37:33 I cannot quite tell the functionality of this clas
Yuwei 2016/09/08 23:09:14 Removed. The original intention was to have a chan
+ private final Client mClient;
+ private RenderStub mRenderStub;
+ private TouchInputHandler mInputHandler;
+
+ public RenderController(Client client) {
+ Preconditions.notNull(client);
+ mClient = client;
+ }
+
+ /**
+ * Sets the render stub. This must be called exactly once before
+ * {@link RenderController#reset(Desktop, DesktopView)} is called.
+ * @param stub The render stub. Must not be null.
joedow 2016/09/08 18:32:47 Is "Must not be null." required in the comment? I
Yuwei 2016/09/08 23:09:15 Obsolete. Class removed.
+ */
+ public void setRenderStub(RenderStub stub) {
+ Preconditions.isNull(mRenderStub);
+ Preconditions.notNull(stub);
+ mRenderStub = stub;
+ }
+
+ /**
+ * Resets the RenderController with the current activity and desktop view. Must be called after
+ * {@link RenderController#setRenderStub(RenderStub)} is called. Both arguments must not be
+ * null.
joedow 2016/09/08 18:32:47 Remove the comments about null params and document
Yuwei 2016/09/08 23:09:15 Obsolete.
+ */
+ public void reset(Desktop desktop, DesktopView view) {
+ Preconditions.notNull(desktop);
+ Preconditions.notNull(view);
+ Preconditions.notNull(mRenderStub);
+ if (mInputHandler != null) {
+ mInputHandler.invalidate();
Yuwei 2016/09/07 20:45:40 Maybe we can make TouchInputHandler's lifetime as
joedow 2016/09/08 18:32:47 I would think of lifetime/scoping with respect to
Yuwei 2016/09/08 23:09:15 Done. Added attach/detach interface to DesktopView
+ }
+ mRenderStub.setDesktopView(view);
+ mInputHandler = new TouchInputHandler(view, desktop);
+ mInputHandler.init(desktop, mRenderStub, new InputEventSender(mClient));
Hzj_jie 2016/09/08 21:37:33 If you really want to keep current design, you may
Yuwei 2016/09/08 23:09:15 Not keeping :P
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698