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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // As V8ValueConverter has finite recursion depth when serializing | 50 // As V8ValueConverter has finite recursion depth when serializing |
51 // JavaScript values, we don't bother about having a recursion threshold here. | 51 // JavaScript values, we don't bother about having a recursion threshold here. |
52 void GinJavaMethodInvocationHelper::BuildObjectRefsFromListValue( | 52 void GinJavaMethodInvocationHelper::BuildObjectRefsFromListValue( |
53 DispatcherDelegate* dispatcher, | 53 DispatcherDelegate* dispatcher, |
54 const base::Value& list_value) { | 54 const base::Value& list_value) { |
55 DCHECK(list_value.IsType(base::Value::Type::LIST)); | 55 DCHECK(list_value.IsType(base::Value::Type::LIST)); |
56 const base::ListValue* list; | 56 const base::ListValue* list; |
57 list_value.GetAsList(&list); | 57 list_value.GetAsList(&list); |
58 for (const auto& entry : *list) { | 58 for (const auto& entry : *list) { |
59 if (AppendObjectRef(dispatcher, *entry)) | 59 if (AppendObjectRef(dispatcher, entry)) |
60 continue; | 60 continue; |
61 if (entry->IsType(base::Value::Type::LIST)) { | 61 if (entry.IsType(base::Value::Type::LIST)) { |
62 BuildObjectRefsFromListValue(dispatcher, *entry); | 62 BuildObjectRefsFromListValue(dispatcher, entry); |
63 } else if (entry->IsType(base::Value::Type::DICTIONARY)) { | 63 } else if (entry.IsType(base::Value::Type::DICTIONARY)) { |
64 BuildObjectRefsFromDictionaryValue(dispatcher, *entry); | 64 BuildObjectRefsFromDictionaryValue(dispatcher, entry); |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void GinJavaMethodInvocationHelper::BuildObjectRefsFromDictionaryValue( | 69 void GinJavaMethodInvocationHelper::BuildObjectRefsFromDictionaryValue( |
70 DispatcherDelegate* dispatcher, | 70 DispatcherDelegate* dispatcher, |
71 const base::Value& dict_value) { | 71 const base::Value& dict_value) { |
72 DCHECK(dict_value.IsType(base::Value::Type::DICTIONARY)); | 72 DCHECK(dict_value.IsType(base::Value::Type::DICTIONARY)); |
73 const base::DictionaryValue* dict; | 73 const base::DictionaryValue* dict; |
74 dict_value.GetAsDictionary(&dict); | 74 dict_value.GetAsDictionary(&dict); |
(...skipping 259 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 |