Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/app/android/blimp_client_session_android.h" | 5 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 GetOSVersionInfoForUserAgent()); | 86 GetOSVersionInfoForUserAgent()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void BlimpClientSessionAndroid::OnDisconnected(int result) { | 89 void BlimpClientSessionAndroid::OnDisconnected(int result) { |
| 90 JNIEnv* env = base::android::AttachCurrentThread(); | 90 JNIEnv* env = base::android::AttachCurrentThread(); |
| 91 Java_BlimpClientSession_onDisconnected( | 91 Java_BlimpClientSession_onDisconnected( |
| 92 env, java_obj_.obj(), base::android::ConvertUTF8ToJavaString( | 92 env, java_obj_.obj(), base::android::ConvertUTF8ToJavaString( |
| 93 env, net::ErrorToShortString(result)).obj()); | 93 env, net::ErrorToShortString(result)).obj()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void BlimpClientSessionAndroid::UpdateDebugInfo( | |
| 97 BlimpConnectionStatistics::StatisticsMap stats) { | |
| 98 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 99 Java_BlimpClientSession_updateDebugStats( | |
| 100 env, java_obj_.obj(), stats[BlimpConnectionStatistics::BYTES_RECEIVED], | |
| 101 stats[BlimpConnectionStatistics::BYTES_SENT], | |
| 102 stats[BlimpConnectionStatistics::COMMIT]); | |
| 103 } | |
| 104 | |
| 96 void BlimpClientSessionAndroid::Destroy(JNIEnv* env, | 105 void BlimpClientSessionAndroid::Destroy(JNIEnv* env, |
| 97 const JavaParamRef<jobject>& jobj) { | 106 const JavaParamRef<jobject>& jobj) { |
| 98 delete this; | 107 delete this; |
| 99 } | 108 } |
| 100 | 109 |
| 101 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( | 110 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( |
| 102 AssignmentSource::Result result, | 111 AssignmentSource::Result result, |
| 103 const Assignment& assignment) { | 112 const Assignment& assignment) { |
| 104 // Notify the front end of the assignment result. | 113 // Notify the front end of the assignment result. |
| 105 std::string engine_ip = IPAddressToStringWithPort( | 114 std::string engine_ip = IPAddressToStringWithPort( |
| 106 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); | 115 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); |
| 107 JNIEnv* env = base::android::AttachCurrentThread(); | 116 JNIEnv* env = base::android::AttachCurrentThread(); |
| 108 Java_BlimpClientSession_onAssignmentReceived( | 117 Java_BlimpClientSession_onAssignmentReceived( |
| 109 env, java_obj_.obj(), static_cast<jint>(result), | 118 env, java_obj_.obj(), static_cast<jint>(result), |
| 110 base::android::ConvertUTF8ToJavaString(env, engine_ip).obj(), | 119 base::android::ConvertUTF8ToJavaString(env, engine_ip).obj(), |
| 111 base::android::ConvertUTF8ToJavaString(env, blimp::kEngineVersion).obj()); | 120 base::android::ConvertUTF8ToJavaString(env, blimp::kEngineVersion).obj()); |
| 112 | 121 |
| 113 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); | 122 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); |
| 114 } | 123 } |
| 115 | 124 |
| 125 void BlimpClientSessionAndroid::GetDebugInfo( | |
| 126 JNIEnv* env, | |
| 127 const base::android::JavaParamRef<jobject>& jobj) { | |
| 128 BlimpClientSession::GetDebugInfo(); | |
|
Kevin M
2016/05/20 01:02:01
BlimpClientSession::GetDebugInfo should have a dif
shaktisahu
2016/05/22 22:36:55
Changed to synchronous, since everything is access
| |
| 129 } | |
| 130 | |
| 116 } // namespace client | 131 } // namespace client |
| 117 } // namespace blimp | 132 } // namespace blimp |
| OLD | NEW |