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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 java_display_.Reset(Java_Display_createJavaDisplayObject( | 59 java_display_.Reset(Java_Display_createJavaDisplayObject( |
60 env, reinterpret_cast<intptr_t>(this))); | 60 env, reinterpret_cast<intptr_t>(this))); |
61 } | 61 } |
62 | 62 |
63 JniDisplayHandler::~JniDisplayHandler() { | 63 JniDisplayHandler::~JniDisplayHandler() { |
64 DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread()); | 64 DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread()); |
65 Java_Display_invalidate(base::android::AttachCurrentThread(), | 65 Java_Display_invalidate(base::android::AttachCurrentThread(), |
66 java_display_.obj()); | 66 java_display_.obj()); |
67 } | 67 } |
68 | 68 |
69 base::android::ScopedJavaLocalRef<jobject> JniDisplayHandler::GetJavaDisplay() { | 69 base::android::ScopedJavaLocalRef<jobject> |
70 return base::android::ScopedJavaLocalRef<jobject>(java_display_); | 70 JniDisplayHandler::CreateDesktopViewFactory() { |
| 71 return Java_Display_createDesktopViewFactory( |
| 72 base::android::AttachCurrentThread(), java_display_.obj()); |
71 } | 73 } |
72 | 74 |
73 void JniDisplayHandler::UpdateCursorShape( | 75 void JniDisplayHandler::UpdateCursorShape( |
74 const protocol::CursorShapeInfo& cursor_shape) { | 76 const protocol::CursorShapeInfo& cursor_shape) { |
75 DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread()); | 77 DCHECK(runtime_->display_task_runner()->BelongsToCurrentThread()); |
76 | 78 |
77 // const_cast<> is safe as long as the Java updateCursorShape() method copies | 79 // const_cast<> is safe as long as the Java updateCursorShape() method copies |
78 // the data out of the buffer without mutating it, and doesn't keep any | 80 // the data out of the buffer without mutating it, and doesn't keep any |
79 // reference to the buffer afterwards. Unfortunately, there seems to be no way | 81 // reference to the buffer afterwards. Unfortunately, there seems to be no way |
80 // to create a read-only ByteBuffer from a pointer-to-const. | 82 // to create a read-only ByteBuffer from a pointer-to-const. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 135 |
134 void JniDisplayHandler::ScheduleRedraw( | 136 void JniDisplayHandler::ScheduleRedraw( |
135 JNIEnv* env, | 137 JNIEnv* env, |
136 const base::android::JavaParamRef<jobject>& caller) { | 138 const base::android::JavaParamRef<jobject>& caller) { |
137 runtime_->display_task_runner()->PostTask( | 139 runtime_->display_task_runner()->PostTask( |
138 FROM_HERE, base::Bind(&JniDisplayHandler::RedrawCanvas, | 140 FROM_HERE, base::Bind(&JniDisplayHandler::RedrawCanvas, |
139 weak_factory_.GetWeakPtr())); | 141 weak_factory_.GetWeakPtr())); |
140 } | 142 } |
141 | 143 |
142 } // namespace remoting | 144 } // namespace remoting |
OLD | NEW |