mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1121489 - Make it possible to construct a RefPtr from an already_AddRefed; r=froydnj
This will pave the way towards having a MakeAndAddRef function that returns an already_AddRefed and can be used in graphics code.
This commit is contained in:
parent
33c16dc39d
commit
2a911035e1
@ -9,6 +9,7 @@
|
||||
#ifndef mozilla_RefPtr_h
|
||||
#define mozilla_RefPtr_h
|
||||
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -235,6 +236,7 @@ public:
|
||||
RefPtr() : mPtr(0) {}
|
||||
RefPtr(const RefPtr& aOther) : mPtr(ref(aOther.mPtr)) {}
|
||||
MOZ_IMPLICIT RefPtr(const TemporaryRef<T>& aOther) : mPtr(aOther.take()) {}
|
||||
MOZ_IMPLICIT RefPtr(already_AddRefed<T>& aOther) : mPtr(aOther.take()) {}
|
||||
MOZ_IMPLICIT RefPtr(T* aVal) : mPtr(ref(aVal)) {}
|
||||
|
||||
template<typename U>
|
||||
@ -252,6 +254,11 @@ public:
|
||||
assign(aOther.take());
|
||||
return *this;
|
||||
}
|
||||
RefPtr& operator=(const already_AddRefed<T>& aOther)
|
||||
{
|
||||
assign(aOther.take());
|
||||
return *this;
|
||||
}
|
||||
RefPtr& operator=(T* aVal)
|
||||
{
|
||||
assign(ref(aVal));
|
||||
|
Loading…
Reference in New Issue
Block a user