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 |
11 #include "base/android/event_log.h" | 11 #include "base/android/event_log.h" |
12 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
| 14 #include "base/memory/ptr_util.h" |
14 #include "content/browser/android/java/gin_java_script_to_java_types_coercion.h" | 15 #include "content/browser/android/java/gin_java_script_to_java_types_coercion.h" |
15 #include "content/browser/android/java/java_method.h" | 16 #include "content/browser/android/java/java_method.h" |
16 #include "content/browser/android/java/jni_helper.h" | 17 #include "content/browser/android/java/jni_helper.h" |
17 #include "content/common/android/gin_java_bridge_value.h" | 18 #include "content/common/android/gin_java_bridge_value.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
19 | 20 |
20 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
21 using base::android::ScopedJavaLocalRef; | 22 using base::android::ScopedJavaLocalRef; |
22 | 23 |
23 namespace content { | 24 namespace content { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // first. | 319 // first. |
319 jobject java_object = | 320 jobject java_object = |
320 object ? env->CallObjectMethodA(object, id, parameters) | 321 object ? env->CallObjectMethodA(object, id, parameters) |
321 : env->CallStaticObjectMethodA(clazz, id, parameters); | 322 : env->CallStaticObjectMethodA(clazz, id, parameters); |
322 if (base::android::ClearException(env)) { | 323 if (base::android::ClearException(env)) { |
323 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); | 324 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); |
324 return; | 325 return; |
325 } | 326 } |
326 ScopedJavaLocalRef<jobject> scoped_java_object(env, java_object); | 327 ScopedJavaLocalRef<jobject> scoped_java_object(env, java_object); |
327 if (!scoped_java_object.obj()) { | 328 if (!scoped_java_object.obj()) { |
328 result_wrapper.Append(base::Value::CreateNullValue()); | 329 result_wrapper.Append(base::MakeUnique<base::Value>()); |
329 break; | 330 break; |
330 } | 331 } |
331 SetObjectResult(scoped_java_object, object_->GetSafeAnnotationClass()); | 332 SetObjectResult(scoped_java_object, object_->GetSafeAnnotationClass()); |
332 return; | 333 return; |
333 } | 334 } |
334 } | 335 } |
335 // This is for all cases except JavaType::TypeObject. | 336 // This is for all cases except JavaType::TypeObject. |
336 if (!base::android::ClearException(env)) { | 337 if (!base::android::ClearException(env)) { |
337 SetPrimitiveResult(result_wrapper); | 338 SetPrimitiveResult(result_wrapper); |
338 } else { | 339 } else { |
339 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); | 340 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); |
340 } | 341 } |
341 } | 342 } |
342 | 343 |
343 } // namespace content | 344 } // namespace content |
OLD | NEW |