| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // As V8ValueConverter has finite recursion depth when serializing | 51 // As V8ValueConverter has finite recursion depth when serializing |
| 52 // JavaScript values, we don't bother about having a recursion threshold here. | 52 // JavaScript values, we don't bother about having a recursion threshold here. |
| 53 void GinJavaMethodInvocationHelper::BuildObjectRefsFromListValue( | 53 void GinJavaMethodInvocationHelper::BuildObjectRefsFromListValue( |
| 54 DispatcherDelegate* dispatcher, | 54 DispatcherDelegate* dispatcher, |
| 55 const base::Value& list_value) { | 55 const base::Value& list_value) { |
| 56 DCHECK(list_value.IsType(base::Value::Type::LIST)); | 56 DCHECK(list_value.IsType(base::Value::Type::LIST)); |
| 57 const base::ListValue* list; | 57 const base::ListValue* list; |
| 58 list_value.GetAsList(&list); | 58 list_value.GetAsList(&list); |
| 59 for (const auto& entry : *list) { | 59 for (const auto& entry : *list) { |
| 60 if (AppendObjectRef(dispatcher, *entry)) | 60 if (AppendObjectRef(dispatcher, entry)) |
| 61 continue; | 61 continue; |
| 62 if (entry->IsType(base::Value::Type::LIST)) { | 62 if (entry.IsType(base::Value::Type::LIST)) { |
| 63 BuildObjectRefsFromListValue(dispatcher, *entry); | 63 BuildObjectRefsFromListValue(dispatcher, entry); |
| 64 } else if (entry->IsType(base::Value::Type::DICTIONARY)) { | 64 } else if (entry.IsType(base::Value::Type::DICTIONARY)) { |
| 65 BuildObjectRefsFromDictionaryValue(dispatcher, *entry); | 65 BuildObjectRefsFromDictionaryValue(dispatcher, entry); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void GinJavaMethodInvocationHelper::BuildObjectRefsFromDictionaryValue( | 70 void GinJavaMethodInvocationHelper::BuildObjectRefsFromDictionaryValue( |
| 71 DispatcherDelegate* dispatcher, | 71 DispatcherDelegate* dispatcher, |
| 72 const base::Value& dict_value) { | 72 const base::Value& dict_value) { |
| 73 DCHECK(dict_value.IsType(base::Value::Type::DICTIONARY)); | 73 DCHECK(dict_value.IsType(base::Value::Type::DICTIONARY)); |
| 74 const base::DictionaryValue* dict; | 74 const base::DictionaryValue* dict; |
| 75 dict_value.GetAsDictionary(&dict); | 75 dict_value.GetAsDictionary(&dict); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 335 } |
| 336 // This is for all cases except JavaType::TypeObject. | 336 // This is for all cases except JavaType::TypeObject. |
| 337 if (!base::android::ClearException(env)) { | 337 if (!base::android::ClearException(env)) { |
| 338 SetPrimitiveResult(result_wrapper); | 338 SetPrimitiveResult(result_wrapper); |
| 339 } else { | 339 } else { |
| 340 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); | 340 SetInvocationError(kGinJavaBridgeJavaExceptionRaised); |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace content | 344 } // namespace content |
| OLD | NEW |