mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1157803 - Clean up Canonical assigment to avoid accidentally tripping the default operator= implementation. r=jww
This commit is contained in:
parent
4eb53fa0b1
commit
aa0a30b445
@ -155,12 +155,12 @@ public:
|
|||||||
return mValue;
|
return mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Canonical& operator=(const T& aNewValue)
|
void Set(const T& aNewValue)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(OwnerThread()->IsCurrentThreadIn());
|
MOZ_ASSERT(OwnerThread()->IsCurrentThreadIn());
|
||||||
|
|
||||||
if (aNewValue == mValue) {
|
if (aNewValue == mValue) {
|
||||||
return *this;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify same-thread watchers. The state watching machinery will make sure
|
// Notify same-thread watchers. The state watching machinery will make sure
|
||||||
@ -184,10 +184,12 @@ public:
|
|||||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(this, &Canonical::DoNotify);
|
nsCOMPtr<nsIRunnable> r = NS_NewRunnableMethod(this, &Canonical::DoNotify);
|
||||||
AbstractThread::GetCurrent()->TailDispatcher().AddDirectTask(r.forget());
|
AbstractThread::GetCurrent()->TailDispatcher().AddDirectTask(r.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Canonical& operator=(const T& aNewValue) { Set(aNewValue); return *this; }
|
||||||
|
Canonical& operator=(const Canonical& aOther) { Set(aOther); return *this; }
|
||||||
|
Canonical(const Canonical& aOther) = delete;
|
||||||
|
|
||||||
class Holder
|
class Holder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -211,7 +213,10 @@ public:
|
|||||||
// Access to the T.
|
// Access to the T.
|
||||||
const T& Ref() const { return *mCanonical; }
|
const T& Ref() const { return *mCanonical; }
|
||||||
operator const T&() const { return Ref(); }
|
operator const T&() const { return Ref(); }
|
||||||
Holder& operator=(const T& aNewValue) { *mCanonical = aNewValue; return *this; }
|
void Set(const T& aNewValue) { mCanonical->Set(aNewValue); }
|
||||||
|
Holder& operator=(const T& aNewValue) { Set(aNewValue); return *this; }
|
||||||
|
Holder& operator=(const Holder& aOther) { Set(aOther); return *this; }
|
||||||
|
Holder(const Holder& aOther) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsRefPtr<Canonical<T>> mCanonical;
|
nsRefPtr<Canonical<T>> mCanonical;
|
||||||
|
Loading…
Reference in New Issue
Block a user