Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 49207fb

Browse files
Bug 1532890 - Get rid of CachedWeakPtr due to unused r=m_kato
The class was created for Quantum Flow, but now, nobody uses it. Differential Revision: https://phabricator.services.mozilla.com/D22266 --HG-- extra : moz-landing-system : lando
1 parent d234f25 commit 49207fb

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

editor/libeditor/EditorBase.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -99,64 +99,6 @@ namespace widget {
9999
struct IMEState;
100100
} // namespace widget
101101

102-
/**
103-
* CachedWeakPtr stores a pointer to a class which inherits nsIWeakReference.
104-
* If the instance of the class has already been destroyed, this returns
105-
* nullptr. Otherwise, returns cached pointer.
106-
* If class T inherits nsISupports a lot, specify Base explicitly for avoiding
107-
* ambiguous conversion to nsISupports.
108-
*/
109-
template <class T, class Base = nsISupports>
110-
class CachedWeakPtr final {
111-
public:
112-
CachedWeakPtr<T, Base>() : mCache(nullptr) {}
113-
explicit CachedWeakPtr<T, Base>(T* aObject) {
114-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(aObject));
115-
mCache = aObject;
116-
}
117-
explicit CachedWeakPtr<T, Base>(const nsCOMPtr<T>& aOther) {
118-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(aOther.get()));
119-
mCache = aOther;
120-
}
121-
explicit CachedWeakPtr<T, Base>(already_AddRefed<T>& aOther) {
122-
RefPtr<T> other = aOther;
123-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(other.get()));
124-
mCache = other;
125-
}
126-
127-
CachedWeakPtr<T, Base>& operator=(T* aObject) {
128-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(aObject));
129-
mCache = aObject;
130-
return *this;
131-
}
132-
CachedWeakPtr<T, Base>& operator=(const nsCOMPtr<T>& aOther) {
133-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(aOther.get()));
134-
mCache = aOther;
135-
return *this;
136-
}
137-
CachedWeakPtr<T, Base>& operator=(already_AddRefed<T>& aOther) {
138-
RefPtr<T> other = aOther;
139-
mWeakPtr = do_GetWeakReference(static_cast<Base*>(other.get()));
140-
mCache = other;
141-
return *this;
142-
}
143-
144-
bool IsAlive() const { return mWeakPtr && mWeakPtr->IsAlive(); }
145-
146-
explicit operator bool() const { return mWeakPtr; }
147-
operator T*() const { return get(); }
148-
T* get() const {
149-
if (mCache && !mWeakPtr->IsAlive()) {
150-
const_cast<CachedWeakPtr<T, Base>*>(this)->mCache = nullptr;
151-
}
152-
return mCache;
153-
}
154-
155-
private:
156-
nsWeakPtr mWeakPtr;
157-
T* MOZ_NON_OWNING_REF mCache;
158-
};
159-
160102
#define kMOZEditorBogusNodeAttrAtom nsGkAtoms::mozeditorbogusnode
161103
#define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
162104

0 commit comments

Comments
 (0)