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

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

Issue 2745583008: Refactoring out the chromoting jni runtime class in favor of chromoting client runtime. (Closed)
Patch Set: Unit tests need to link with android. Created 3 years, 9 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/jni/jni_gl_display_handler.cc
diff --git a/remoting/client/jni/jni_gl_display_handler.cc b/remoting/client/jni/jni_gl_display_handler.cc
index 742c088c144698720839840f1d8537adc31df12a..0d3d38482c6a4dbbdaceb7da9e93f424604b62ea 100644
--- a/remoting/client/jni/jni_gl_display_handler.cc
+++ b/remoting/client/jni/jni_gl_display_handler.cc
@@ -12,10 +12,10 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "jni/GlDisplay_jni.h"
+#include "remoting/client/chromoting_client_runtime.h"
#include "remoting/client/cursor_shape_stub_proxy.h"
#include "remoting/client/display/gl_canvas.h"
#include "remoting/client/dual_buffer_frame_consumer.h"
-#include "remoting/client/jni/chromoting_jni_runtime.h"
#include "remoting/client/jni/egl_thread_context.h"
#include "remoting/client/software_video_renderer.h"
#include "remoting/protocol/frame_consumer.h"
@@ -27,7 +27,7 @@ namespace remoting {
class JniGlDisplayHandler::Core : public protocol::CursorShapeStub,
public GlRendererDelegate {
public:
- Core(ChromotingJniRuntime* runtime, base::WeakPtr<JniGlDisplayHandler> shell);
+ Core(base::WeakPtr<JniGlDisplayHandler> shell);
~Core() override;
// GlRendererDelegate interface.
@@ -60,7 +60,7 @@ class JniGlDisplayHandler::Core : public protocol::CursorShapeStub,
// Initializes the core on the display thread.
void Initialize();
- ChromotingJniRuntime* runtime_;
+ ChromotingClientRuntime* runtime_;
base::WeakPtr<JniGlDisplayHandler> shell_;
// Will be std::move'd when GrabFrameConsumer() is called.
@@ -79,9 +79,9 @@ class JniGlDisplayHandler::Core : public protocol::CursorShapeStub,
DISALLOW_COPY_AND_ASSIGN(Core);
};
-JniGlDisplayHandler::Core::Core(ChromotingJniRuntime* runtime,
- base::WeakPtr<JniGlDisplayHandler> shell)
- : runtime_(runtime), shell_(shell), weak_factory_(this) {
+JniGlDisplayHandler::Core::Core(base::WeakPtr<JniGlDisplayHandler> shell)
+ : shell_(shell), weak_factory_(this) {
+ runtime_ = ChromotingClientRuntime::GetInstance();
DCHECK(!runtime_->display_task_runner()->BelongsToCurrentThread());
runtime_->display_task_runner()->PostTask(
FROM_HERE, base::Bind(&JniGlDisplayHandler::Core::Initialize,
@@ -209,12 +209,11 @@ void JniGlDisplayHandler::Core::Initialize() {
// Shell implementations.
JniGlDisplayHandler::JniGlDisplayHandler(
- ChromotingJniRuntime* runtime,
const base::android::JavaRef<jobject>& java_client)
- : runtime_(runtime),
- ui_task_poster_(runtime->display_task_runner()),
+ : runtime_(ChromotingClientRuntime::GetInstance()),
+ ui_task_poster_(runtime_->display_task_runner()),
weak_factory_(this) {
- core_.reset(new Core(runtime_, weak_factory_.GetWeakPtr()));
+ core_.reset(new Core(weak_factory_.GetWeakPtr()));
JNIEnv* env = base::android::AttachCurrentThread();
java_display_.Reset(Java_GlDisplay_createJavaDisplayObject(
env, reinterpret_cast<intptr_t>(this)));

Powered by Google App Engine
This is Rietveld 408576698