Name Description Size
Accessors.h 7342
Conversions.cpp 3156
Conversions.h 686
GeckoBundleUtils.cpp 10090
GeckoBundleUtils.h 2128
GeckoResultUtils.h 2034
moz.build 812
Natives.h C++ classes implementing instance (non-static) native methods can choose from one of two ownership models, when associating a C++ object with a Java instance. * If the C++ class inherits from mozilla::SupportsWeakPtr, weak pointers will be used. The Java instance will store and own the pointer to a WeakPtr object. The C++ class itself is otherwise not owned or directly referenced. Note that mozilla::SupportsWeakPtr only supports being used on a single thread. To attach a Java instance to a C++ instance, pass in a mozilla::SupportsWeakPtr pointer to the C++ class (i.e. MyClass*). class MyClass : public SupportsWeakPtr , public MyJavaClass::Natives<MyClass> { // ... public: using MyJavaClass::Natives<MyClass>::DisposeNative; void AttachTo(const MyJavaClass::LocalRef& instance) { MyJavaClass::Natives<MyClass>::AttachNative( instance, static_cast<SupportsWeakPtr*>(this)); // "instance" does NOT own "this", so the C++ object // lifetime is separate from the Java object lifetime. } }; * If the C++ class contains public members AddRef() and Release(), the Java instance will store and own the pointer to a RefPtr object, which holds a strong reference on the C++ instance. Normal ref-counting considerations apply in this case; for example, disposing may cause the C++ instance to be deleted and the destructor to be run on the current thread, which may not be desirable. To attach a Java instance to a C++ instance, pass in a pointer to the C++ class (i.e. MyClass*). class MyClass : public RefCounted<MyClass> , public MyJavaClass::Natives<MyClass> { // ... public: using MyJavaClass::Natives<MyClass>::DisposeNative; void AttachTo(const MyJavaClass::LocalRef& instance) { MyJavaClass::Natives<MyClass>::AttachNative(instance, this); // "instance" owns "this" through the RefPtr, so the C++ object // may be destroyed as soon as instance.disposeNative() is called. } }; * In other cases, the Java instance will store and own a pointer to the C++ object itself. This pointer must not be stored or deleted elsewhere. To attach a Java instance to a C++ instance, pass in a reference to a UniquePtr of the C++ class (i.e. UniquePtr<MyClass>). class MyClass : public MyJavaClass::Natives<MyClass> { // ... public: using MyJavaClass::Natives<MyClass>::DisposeNative; static void AttachTo(const MyJavaClass::LocalRef& instance) { MyJavaClass::Natives<MyClass>::AttachNative( instance, mozilla::MakeUnique<MyClass>()); // "instance" owns the newly created C++ object, so the C++ // object is destroyed as soon as instance.disposeNative() is // called. } }; 56464
Refs.h 35432
TypeAdapter.h 3602
Types.h 4669
Utils.cpp nothing 11419
Utils.h 4468