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

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

Issue 2142253002: [Remoting Android] Fix GetWeakPtr() calls on multiple threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_display_handler.h ('k') | remoting/client/jni/jni_pairing_secret_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/jni/jni_display_handler.cc
diff --git a/remoting/client/jni/jni_display_handler.cc b/remoting/client/jni/jni_display_handler.cc
index 185a9724069b1e509db00a1c43766f08381413c5..20e278f04ed6259975ac8f6774302091ce4765c0 100644
--- a/remoting/client/jni/jni_display_handler.cc
+++ b/remoting/client/jni/jni_display_handler.cc
@@ -55,6 +55,7 @@ void DisplayCursorShapeStub::SetCursorShape(
JniDisplayHandler::JniDisplayHandler(ChromotingJniRuntime* runtime)
: runtime_(runtime),
weak_factory_(this) {
+ weak_ptr_ = weak_factory_.GetWeakPtr();
JNIEnv* env = base::android::AttachCurrentThread();
java_display_.Reset(Java_Display_createJavaDisplayObject(
env, reinterpret_cast<intptr_t>(this)));
@@ -95,14 +96,13 @@ void JniDisplayHandler::UpdateCursorShape(
std::unique_ptr<protocol::CursorShapeStub>
JniDisplayHandler::CreateCursorShapeStub() {
return base::WrapUnique(
- new DisplayCursorShapeStub(weak_factory_.GetWeakPtr(),
- runtime_->display_task_runner()));
+ new DisplayCursorShapeStub(weak_ptr_, runtime_->display_task_runner()));
}
std::unique_ptr<protocol::VideoRenderer>
JniDisplayHandler::CreateVideoRenderer() {
return base::WrapUnique(
- new JniVideoRenderer(runtime_, weak_factory_.GetWeakPtr()));
+ new JniVideoRenderer(runtime_, weak_ptr_));
}
// static
@@ -137,8 +137,7 @@ void JniDisplayHandler::ScheduleRedraw(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller) {
runtime_->display_task_runner()->PostTask(
- FROM_HERE, base::Bind(&JniDisplayHandler::RedrawCanvas,
- weak_factory_.GetWeakPtr()));
+ FROM_HERE, base::Bind(&JniDisplayHandler::RedrawCanvas, weak_ptr_));
}
} // namespace remoting
« no previous file with comments | « remoting/client/jni/jni_display_handler.h ('k') | remoting/client/jni/jni_pairing_secret_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698