OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/java/java_method.h" | 5 #include "content/browser/renderer_host/java/java_method.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ReplaceSubstringsAfterOffset(&jni_name, 0, ".", "/"); | 79 ReplaceSubstringsAfterOffset(&jni_name, 0, ".", "/"); |
80 return jni_name; | 80 return jni_name; |
81 } | 81 } |
82 case JavaType::TypeString: | 82 case JavaType::TypeString: |
83 case JavaType::TypeObject: | 83 case JavaType::TypeObject: |
84 std::string jni_name = "L" + binary_name + ";"; | 84 std::string jni_name = "L" + binary_name + ";"; |
85 ReplaceSubstringsAfterOffset(&jni_name, 0, ".", "/"); | 85 ReplaceSubstringsAfterOffset(&jni_name, 0, ".", "/"); |
86 return jni_name; | 86 return jni_name; |
87 } | 87 } |
88 NOTREACHED(); | 88 NOTREACHED(); |
89 return EmptyString(); | 89 return std::string(); |
90 } | 90 } |
91 | 91 |
92 } // namespace | 92 } // namespace |
93 | 93 |
94 JavaMethod::JavaMethod(const base::android::JavaRef<jobject>& method) | 94 JavaMethod::JavaMethod(const base::android::JavaRef<jobject>& method) |
95 : java_method_(method), | 95 : java_method_(method), |
96 have_calculated_num_parameters_(false), | 96 have_calculated_num_parameters_(false), |
97 id_(NULL) { | 97 id_(NULL) { |
98 JNIEnv* env = AttachCurrentThread(); | 98 JNIEnv* env = AttachCurrentThread(); |
99 // On construction, we do nothing except get the name. Everything else is | 99 // On construction, we do nothing except get the name. Everything else is |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 kReturningJavaLangClass)))); | 228 kReturningJavaLangClass)))); |
229 id_ = is_static ? | 229 id_ = is_static ? |
230 MethodID::Get<MethodID::TYPE_STATIC>( | 230 MethodID::Get<MethodID::TYPE_STATIC>( |
231 env, declaring_class.obj(), name_.c_str(), signature.c_str()) : | 231 env, declaring_class.obj(), name_.c_str(), signature.c_str()) : |
232 MethodID::Get<MethodID::TYPE_INSTANCE>( | 232 MethodID::Get<MethodID::TYPE_INSTANCE>( |
233 env, declaring_class.obj(), name_.c_str(), signature.c_str()); | 233 env, declaring_class.obj(), name_.c_str(), signature.c_str()); |
234 java_method_.Reset(); | 234 java_method_.Reset(); |
235 } | 235 } |
236 | 236 |
237 } // namespace content | 237 } // namespace content |
OLD | NEW |