| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 JavaBoundObject( | 59 JavaBoundObject( |
| 60 const base::android::JavaRef<jobject>& object, | 60 const base::android::JavaRef<jobject>& object, |
| 61 const base::android::JavaRef<jclass>& safe_annotation_clazz, | 61 const base::android::JavaRef<jclass>& safe_annotation_clazz, |
| 62 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager, | 62 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager, |
| 63 bool can_enumerate_methods); | 63 bool can_enumerate_methods); |
| 64 | 64 |
| 65 void EnsureMethodsAreSetUp() const; | 65 void EnsureMethodsAreSetUp() const; |
| 66 | 66 |
| 67 static void ThrowSecurityException(const char* message); |
| 68 |
| 67 // The weak ref to the underlying Java object that this JavaBoundObject | 69 // The weak ref to the underlying Java object that this JavaBoundObject |
| 68 // instance represents. | 70 // instance represents. |
| 69 JavaObjectWeakGlobalRef java_object_; | 71 JavaObjectWeakGlobalRef java_object_; |
| 70 | 72 |
| 71 // Keep a pointer back to the JavaBridgeDispatcherHostManager so that we | 73 // Keep a pointer back to the JavaBridgeDispatcherHostManager so that we |
| 72 // can notify it when this JavaBoundObject is destroyed. JavaBoundObjects | 74 // can notify it when this JavaBoundObject is destroyed. JavaBoundObjects |
| 73 // may outlive the manager so keep a WeakPtr. Note the WeakPtr may only be | 75 // may outlive the manager so keep a WeakPtr. Note the WeakPtr may only be |
| 74 // dereferenced on the UI thread. | 76 // dereferenced on the UI thread. |
| 75 base::WeakPtr<JavaBridgeDispatcherHostManager> manager_; | 77 base::WeakPtr<JavaBridgeDispatcherHostManager> manager_; |
| 76 | 78 |
| 77 // Map of public methods, from method name to Method instance. Multiple | 79 // Map of public methods, from method name to Method instance. Multiple |
| 78 // entries will be present for overloaded methods. Note that we can't use | 80 // entries will be present for overloaded methods. Note that we can't use |
| 79 // scoped_ptr in STL containers as we can't copy it. | 81 // scoped_ptr in STL containers as we can't copy it. |
| 80 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; | 82 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; |
| 81 mutable JavaMethodMap methods_; | 83 mutable JavaMethodMap methods_; |
| 82 mutable bool are_methods_set_up_; | 84 mutable bool are_methods_set_up_; |
| 85 mutable jmethodID object_get_class_method_id_; |
| 83 const bool can_enumerate_methods_; | 86 const bool can_enumerate_methods_; |
| 84 | 87 |
| 85 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; | 88 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; |
| 86 | 89 |
| 87 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); | 90 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace content | 93 } // namespace content |
| 91 | 94 |
| 92 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 95 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| OLD | NEW |