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

Unified Diff: remoting/client/jni/jni_gl_display_handler.h

Issue 2032963002: WIP - OpenGL Native Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into gl Created 4 years, 5 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
« no previous file with comments | « remoting/client/jni/jni_client.cc ('k') | remoting/client/jni/jni_gl_display_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/jni_gl_display_handler.h
diff --git a/remoting/client/jni/jni_gl_display_handler.h b/remoting/client/jni/jni_gl_display_handler.h
index 7ddfaaa6b85f9cc1d160a14409a451074499c1c6..ee2cc7cfac405086cca7375ac441a4c980ff871f 100644
--- a/remoting/client/jni/jni_gl_display_handler.h
+++ b/remoting/client/jni/jni_gl_display_handler.h
@@ -5,23 +5,31 @@
#ifndef REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_
#define REMOTING_CLIENT_JNI_JNI_GL_DISPLAY_HANDLER_H_
+#include <EGL/egl.h>
#include <jni.h>
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "remoting/client/gl_renderer.h"
+#include "remoting/client/gl_renderer_delegate.h"
#include "remoting/client/jni/display_updater_factory.h"
+#include "remoting/protocol/cursor_shape_stub.h"
namespace remoting {
class ChromotingJniRuntime;
+class DualBufferFrameConsumer;
+class EglThreadContext;
// Handles OpenGL display operations. Draws desktop and cursor on the OpenGL
// surface.
// JNI functions should all be called on the UI thread. The display handler
// itself should be deleted on the display thread.
// Please see GlDisplay.java for documentations.
-class JniGlDisplayHandler : public DisplayUpdaterFactory {
+class JniGlDisplayHandler : public DisplayUpdaterFactory,
+ public protocol::CursorShapeStub,
+ public GlRendererDelegate {
public:
JniGlDisplayHandler(ChromotingJniRuntime* runtime);
~JniGlDisplayHandler() override;
@@ -29,10 +37,19 @@ class JniGlDisplayHandler : public DisplayUpdaterFactory {
// Sets the DesktopViewFactory for the Java client.
void InitializeClient(
const base::android::JavaRef<jobject>& java_client);
+
+ // CursorShapeStub override.
+ void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) override;
+
// DisplayUpdaterFactory overrides.
std::unique_ptr<protocol::CursorShapeStub> CreateCursorShapeStub() override;
std::unique_ptr<protocol::VideoRenderer> CreateVideoRenderer() override;
+ // GlrendererDelegate overrides.
+ bool CanRenderFrame() override;
+ void OnFrameRendered() override;
+ void OnSizeChanged(int width, int height) override;
+
static bool RegisterJni(JNIEnv* env);
void OnSurfaceCreated(
@@ -59,7 +76,8 @@ class JniGlDisplayHandler : public DisplayUpdaterFactory {
JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller,
int x,
- int y);
+ int y,
+ bool followed_by_viewport_move);
void OnCursorVisibilityChanged(
JNIEnv* env,
@@ -78,11 +96,25 @@ class JniGlDisplayHandler : public DisplayUpdaterFactory {
jboolean enabled);
private:
- static void NotifyRenderEventOnUiThread(
- base::android::ScopedJavaGlobalRef<jobject> java_client);
+ void SetRenderEventEnabledOnDisplayThread(bool enabled);
+
+ static void NotifyRenderDoneOnUiThread(
+ base::android::ScopedJavaGlobalRef<jobject> java_display);
+
+ void SurfaceCreatedOnDisplayThread(
+ base::android::ScopedJavaGlobalRef<jobject> surface);
+
+ void SurfaceDestroyedOnDisplayThread();
+
+ void ChangePixelTransformationOnDisplayThread(
+ base::android::ScopedJavaGlobalRef<jfloatArray> jmatrix);
+
+ void ChangeCursorPositionOnDisplayThread(int x,
+ int y,
+ bool followed_by_viewport_move);
static void ChangeCanvasSizeOnUiThread(
- base::android::ScopedJavaGlobalRef<jobject> java_client,
+ base::android::ScopedJavaGlobalRef<jobject> java_display,
int width,
int height);
@@ -90,6 +122,19 @@ class JniGlDisplayHandler : public DisplayUpdaterFactory {
base::android::ScopedJavaGlobalRef<jobject> java_display_;
+ std::unique_ptr<EglThreadContext> egl_context_;
+
+ base::WeakPtr<DualBufferFrameConsumer> frame_consumer_;
+
+ bool render_event_enabled_ = false;
+ bool rendering_blocked_ = false;
+
+ // |renderer_| must be deleted earlier than |egl_context_|.
+ GlRenderer renderer_;
+
+ // Used on display thread.
+ base::WeakPtr<JniGlDisplayHandler> weak_ptr_;
+ base::WeakPtrFactory<JniGlDisplayHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(JniGlDisplayHandler);
};
« no previous file with comments | « remoting/client/jni/jni_client.cc ('k') | remoting/client/jni/jni_gl_display_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698