| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 JNIEnv* env, | 104 JNIEnv* env, |
| 105 const base::android::JavaParamRef<jobject>& jobj) { | 105 const base::android::JavaParamRef<jobject>& jobj) { |
| 106 delete this; | 106 delete this; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( | 109 void BlimpClientSessionAndroid::OnAssignmentConnectionAttempted( |
| 110 AssignmentRequestResult result, | 110 AssignmentRequestResult result, |
| 111 const Assignment& assignment) { | 111 const Assignment& assignment) { |
| 112 // Notify the front end of the assignment result. | 112 // Notify the front end of the assignment result. |
| 113 std::string engine_ip = IPAddressToStringWithPort( | 113 std::string engine_ip = IPAddressToStringWithPort( |
| 114 assignment.engine_endpoint.address(), assignment.engine_endpoint.port()); | 114 assignment.assignment_options.engine_endpoint.address(), |
| 115 assignment.assignment_options.engine_endpoint.port()); |
| 115 JNIEnv* env = base::android::AttachCurrentThread(); | 116 JNIEnv* env = base::android::AttachCurrentThread(); |
| 116 Java_BlimpClientSession_onAssignmentReceived( | 117 Java_BlimpClientSession_onAssignmentReceived( |
| 117 env, java_obj_, static_cast<jint>(result), | 118 env, java_obj_, static_cast<jint>(result), |
| 118 base::android::ConvertUTF8ToJavaString(env, engine_ip), | 119 base::android::ConvertUTF8ToJavaString(env, engine_ip), |
| 119 base::android::ConvertUTF8ToJavaString(env, | 120 base::android::ConvertUTF8ToJavaString(env, |
| 120 version_info::GetVersionNumber())); | 121 version_info::GetVersionNumber())); |
| 121 | 122 |
| 122 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); | 123 BlimpClientSession::OnAssignmentConnectionAttempted(result, assignment); |
| 123 } | 124 } |
| 124 | 125 |
| 125 base::android::ScopedJavaLocalRef<jintArray> | 126 base::android::ScopedJavaLocalRef<jintArray> |
| 126 BlimpClientSessionAndroid::GetDebugInfo( | 127 BlimpClientSessionAndroid::GetDebugInfo( |
| 127 JNIEnv* env, | 128 JNIEnv* env, |
| 128 const base::android::JavaParamRef<jobject>& jobj) { | 129 const base::android::JavaParamRef<jobject>& jobj) { |
| 129 BlimpStats* stats = BlimpStats::GetInstance(); | 130 BlimpStats* stats = BlimpStats::GetInstance(); |
| 130 int metrics[] = {stats->Get(BlimpStats::BYTES_RECEIVED), | 131 int metrics[] = {stats->Get(BlimpStats::BYTES_RECEIVED), |
| 131 stats->Get(BlimpStats::BYTES_SENT), | 132 stats->Get(BlimpStats::BYTES_SENT), |
| 132 stats->Get(BlimpStats::COMMIT)}; | 133 stats->Get(BlimpStats::COMMIT)}; |
| 133 return base::android::ToJavaIntArray(env, metrics, arraysize(metrics)); | 134 return base::android::ToJavaIntArray(env, metrics, arraysize(metrics)); |
| 134 } | 135 } |
| 135 | 136 |
| 136 } // namespace client | 137 } // namespace client |
| 137 } // namespace blimp | 138 } // namespace blimp |
| OLD | NEW |