| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/jni/jni_display_handler.h" | 5 #include "remoting/client/jni/jni_display_handler.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "jni/Display_jni.h" | 12 #include "jni/Display_jni.h" |
| 13 #include "remoting/client/jni/chromoting_jni_runtime.h" | 13 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 14 #include "remoting/client/jni/jni_client.h" | 14 #include "remoting/client/jni/jni_client.h" |
| 15 #include "remoting/client/jni/jni_frame_consumer.h" | |
| 16 #include "remoting/client/jni/jni_video_renderer.h" | 15 #include "remoting/client/jni/jni_video_renderer.h" |
| 17 | 16 |
| 18 using base::android::JavaParamRef; | 17 using base::android::JavaParamRef; |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 const int kBytesPerPixel = 4; | 21 const int kBytesPerPixel = 4; |
| 23 | 22 |
| 24 } | 23 } |
| 25 | 24 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 env, env->NewDirectByteBuffer(data, cursor_total_bytes)); | 80 env, env->NewDirectByteBuffer(data, cursor_total_bytes)); |
| 82 Java_Display_updateCursorShape( | 81 Java_Display_updateCursorShape( |
| 83 env, java_display_.obj(), cursor_shape.width(), cursor_shape.height(), | 82 env, java_display_.obj(), cursor_shape.width(), cursor_shape.height(), |
| 84 cursor_shape.hotspot_x(), cursor_shape.hotspot_y(), buffer.obj()); | 83 cursor_shape.hotspot_x(), cursor_shape.hotspot_y(), buffer.obj()); |
| 85 } | 84 } |
| 86 | 85 |
| 87 std::unique_ptr<protocol::CursorShapeStub> | 86 std::unique_ptr<protocol::CursorShapeStub> |
| 88 JniDisplayHandler::CreateCursorShapeStub() { | 87 JniDisplayHandler::CreateCursorShapeStub() { |
| 89 return base::WrapUnique( | 88 return base::WrapUnique( |
| 90 new DisplayCursorShapeStub(weak_factory_.GetWeakPtr(), | 89 new DisplayCursorShapeStub(weak_factory_.GetWeakPtr(), |
| 91 runtime_->display_task_runner())); | 90 runtime_->display_task_runner())); |
| 92 } | 91 } |
| 93 | 92 |
| 94 std::unique_ptr<JniVideoRenderer> JniDisplayHandler::CreateVideoRenderer() { | 93 std::unique_ptr<protocol::VideoRenderer> |
| 94 JniDisplayHandler::CreateVideoRenderer() { |
| 95 return base::WrapUnique( | 95 return base::WrapUnique( |
| 96 new JniFrameConsumer(runtime_, weak_factory_.GetWeakPtr())); | 96 new JniVideoRenderer(runtime_, weak_factory_.GetWeakPtr())); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // static | 99 // static |
| 100 base::android::ScopedJavaLocalRef<jobject> JniDisplayHandler::NewBitmap( | 100 base::android::ScopedJavaLocalRef<jobject> JniDisplayHandler::NewBitmap( |
| 101 int width, | 101 int width, |
| 102 int height) { | 102 int height) { |
| 103 JNIEnv* env = base::android::AttachCurrentThread(); | 103 JNIEnv* env = base::android::AttachCurrentThread(); |
| 104 return Java_Display_newBitmap(env, width, height); | 104 return Java_Display_newBitmap(env, width, height); |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 weak_factory_.GetWeakPtr())); | 142 weak_factory_.GetWeakPtr())); |
| 143 } | 143 } |
| 144 | 144 |
| 145 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 145 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
| 146 return reinterpret_cast<intptr_t>(new JniDisplayHandler( | 146 return reinterpret_cast<intptr_t>(new JniDisplayHandler( |
| 147 ChromotingJniRuntime::GetInstance(), | 147 ChromotingJniRuntime::GetInstance(), |
| 148 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); | 148 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace remoting | 151 } // namespace remoting |
| OLD | NEW |