Chromium Code Reviews| 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_client.h" | 5 #include "remoting/client/jni/jni_client.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "jni/Client_jni.h" | 10 #include "jni/Client_jni.h" |
| 11 #include "remoting/client/jni/chromoting_jni_instance.h" | 11 #include "remoting/client/jni/chromoting_jni_instance.h" |
| 12 #include "remoting/client/jni/chromoting_jni_runtime.h" | 12 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 13 #include "remoting/client/jni/display_updater_factory.h" | |
| 14 #include "remoting/client/jni/jni_gl_display_handler.h" | 13 #include "remoting/client/jni/jni_gl_display_handler.h" |
| 15 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" | 14 #include "remoting/client/jni/jni_pairing_secret_fetcher.h" |
| 16 #include "remoting/client/jni/jni_touch_event_data.h" | 15 #include "remoting/client/jni/jni_touch_event_data.h" |
| 17 #include "remoting/protocol/video_renderer.h" | 16 #include "remoting/protocol/video_renderer.h" |
| 18 | 17 |
| 19 using base::android::ConvertJavaStringToUTF8; | 18 using base::android::ConvertJavaStringToUTF8; |
| 20 using base::android::ConvertUTF8ToJavaString; | 19 using base::android::ConvertUTF8ToJavaString; |
| 21 using base::android::JavaParamRef; | 20 using base::android::JavaParamRef; |
| 22 using base::android::ScopedJavaLocalRef; | 21 using base::android::ScopedJavaLocalRef; |
| 23 | 22 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | 66 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); |
| 68 if (session_) { | 67 if (session_) { |
| 69 session_->Disconnect(); | 68 session_->Disconnect(); |
| 70 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, | 69 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, |
| 71 session_.release()); | 70 session_.release()); |
| 72 } | 71 } |
| 73 if (secret_fetcher_) { | 72 if (secret_fetcher_) { |
| 74 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, | 73 runtime_->network_task_runner()->DeleteSoon(FROM_HERE, |
| 75 secret_fetcher_.release()); | 74 secret_fetcher_.release()); |
| 76 } | 75 } |
| 77 if (display_handler_) { | 76 if (display_handler_) { |
|
Hzj_jie
2016/09/13 19:32:12
You do not need to do this check, unique_ptr will
Yuwei
2016/09/13 20:49:40
Oops... Forgot that.
Done.
| |
| 78 runtime_->display_task_runner()->DeleteSoon(FROM_HERE, | 77 display_handler_.reset(); |
| 79 display_handler_.release()); | |
| 80 } | 78 } |
| 81 } | 79 } |
| 82 | 80 |
| 83 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, | 81 void JniClient::OnConnectionState(protocol::ConnectionToHost::State state, |
| 84 protocol::ErrorCode error) { | 82 protocol::ErrorCode error) { |
| 85 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); | 83 DCHECK(runtime_->ui_task_runner()->BelongsToCurrentThread()); |
| 86 | 84 |
| 87 JNIEnv* env = base::android::AttachCurrentThread(); | 85 JNIEnv* env = base::android::AttachCurrentThread(); |
| 88 Java_Client_onConnectionState(env, java_client_, state, error); | 86 Java_Client_onConnectionState(env, java_client_, state, error); |
| 89 } | 87 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 return weak_ptr_; | 291 return weak_ptr_; |
| 294 } | 292 } |
| 295 | 293 |
| 296 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { | 294 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& caller) { |
| 297 return reinterpret_cast<intptr_t>( | 295 return reinterpret_cast<intptr_t>( |
| 298 new JniClient(ChromotingJniRuntime::GetInstance(), | 296 new JniClient(ChromotingJniRuntime::GetInstance(), |
| 299 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); | 297 base::android::ScopedJavaGlobalRef<jobject>(env, caller))); |
| 300 } | 298 } |
| 301 | 299 |
| 302 } // namespace remoting | 300 } // namespace remoting |
| OLD | NEW |