| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/android/java/gin_java_method_invocation_helper.h" | 5 #include "content/browser/android/java/gin_java_method_invocation_helper.h" |
| 6 | 6 |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 std::unique_ptr<const GinJavaBridgeValue> value( | 93 std::unique_ptr<const GinJavaBridgeValue> value( |
| 94 GinJavaBridgeValue::FromValue(&raw_value)); | 94 GinJavaBridgeValue::FromValue(&raw_value)); |
| 95 if (!value->IsType(GinJavaBridgeValue::TYPE_OBJECT_ID)) | 95 if (!value->IsType(GinJavaBridgeValue::TYPE_OBJECT_ID)) |
| 96 return false; | 96 return false; |
| 97 GinJavaBoundObject::ObjectID object_id; | 97 GinJavaBoundObject::ObjectID object_id; |
| 98 if (value->GetAsObjectID(&object_id)) { | 98 if (value->GetAsObjectID(&object_id)) { |
| 99 ObjectRefs::iterator iter = object_refs_.find(object_id); | 99 ObjectRefs::iterator iter = object_refs_.find(object_id); |
| 100 if (iter == object_refs_.end()) { | 100 if (iter == object_refs_.end()) { |
| 101 JavaObjectWeakGlobalRef object_ref( | 101 JavaObjectWeakGlobalRef object_ref( |
| 102 dispatcher->GetObjectWeakRef(object_id)); | 102 dispatcher->GetObjectWeakRef(object_id)); |
| 103 if (!object_ref.is_empty()) { | 103 if (!object_ref.is_uninitialized()) { |
| 104 object_refs_.insert(std::make_pair(object_id, object_ref)); | 104 object_refs_.insert(std::make_pair(object_id, object_ref)); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 return true; | 108 return true; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void GinJavaMethodInvocationHelper::Invoke() { | 111 void GinJavaMethodInvocationHelper::Invoke() { |
| 112 JNIEnv* env = AttachCurrentThread(); | 112 JNIEnv* env = AttachCurrentThread(); |
| 113 const JavaMethod* method = | 113 const JavaMethod* method = |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 // This is for all cases except JavaType::TypeObject. | 335 // This is for all cases except JavaType::TypeObject. |
| 336 if (!base::android::ClearException(env)) { | 336 if (!base::android::ClearException(env)) { |
| 337 SetPrimitiveResult(result_wrapper); | 337 SetPrimitiveResult(result_wrapper); |
| 338 } else { | 338 } else { |
| 339 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); | 339 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace content | 343 } // namespace content |
| OLD | NEW |