summaryrefslogtreecommitdiffstats
path: root/xpcom
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 05:47:12 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 05:47:12 -0400
commit32e8155127126c187ce32f7368742057bcaf69da (patch)
tree61fd4472558f959f7695b3940e7ed5ea7628e5ed /xpcom
parent2e2190a5044943bde31679996afdc3558d22231b (diff)
downloadUXP-32e8155127126c187ce32f7368742057bcaf69da.tar
UXP-32e8155127126c187ce32f7368742057bcaf69da.tar.gz
UXP-32e8155127126c187ce32f7368742057bcaf69da.tar.lz
UXP-32e8155127126c187ce32f7368742057bcaf69da.tar.xz
UXP-32e8155127126c187ce32f7368742057bcaf69da.zip
Bug 1372829 - Part 2: mozilla::EditorBase should cache raw pointer of nsISelectionController and nsIDocument with nsWeakPtr
Tag #1375
Diffstat (limited to 'xpcom')
-rw-r--r--xpcom/base/nsIWeakReference.idl5
-rw-r--r--xpcom/glue/nsWeakReference.cpp1
2 files changed, 6 insertions, 0 deletions
diff --git a/xpcom/base/nsIWeakReference.idl b/xpcom/base/nsIWeakReference.idl
index 73390b15f..7f6880fad 100644
--- a/xpcom/base/nsIWeakReference.idl
+++ b/xpcom/base/nsIWeakReference.idl
@@ -37,6 +37,11 @@ interface nsIWeakReference : nsISupports
%{C++
virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
+
+ /**
+ * Returns true if the referring object is alive. Otherwise, false.
+ */
+ virtual bool IsAlive() const = 0;
%}
};
diff --git a/xpcom/glue/nsWeakReference.cpp b/xpcom/glue/nsWeakReference.cpp
index 57f372641..be263e1c2 100644
--- a/xpcom/glue/nsWeakReference.cpp
+++ b/xpcom/glue/nsWeakReference.cpp
@@ -37,6 +37,7 @@ public:
// nsIWeakReference...
NS_DECL_NSIWEAKREFERENCE
virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
+ bool IsAlive() const override { return mReferent != nullptr; }
private:
MOZ_WEAKREF_DECL_OWNINGTHREAD