зеркало из https://github.com/mozilla/gecko-dev.git
Bug 396369 - "Overload forget method on nsCOMPtr/nsRefPtr to work with out parameters". r=dbaron, sr=bsmedberg, a=damons.
This commit is contained in:
Родитель
124fe70e86
Коммит
491c9c1063
|
@ -1042,6 +1042,17 @@ class nsRefPtr
|
|||
return temp;
|
||||
}
|
||||
|
||||
void
|
||||
forget( T** rhs )
|
||||
// Set the target of rhs to the value of mRawPtr and null out mRawPtr.
|
||||
// Useful to avoid unnecessary AddRef/Release pairs with "out"
|
||||
// parameters.
|
||||
{
|
||||
NS_ASSERTION(rhs, "Null pointer passed to forget!");
|
||||
*rhs = 0;
|
||||
swap(*rhs);
|
||||
}
|
||||
|
||||
T*
|
||||
get() const
|
||||
/*
|
||||
|
|
|
@ -829,6 +829,17 @@ class nsCOMPtr
|
|||
return temp;
|
||||
}
|
||||
|
||||
void
|
||||
forget( T** rhs )
|
||||
// Set the target of rhs to the value of mRawPtr and null out mRawPtr.
|
||||
// Useful to avoid unnecessary AddRef/Release pairs with "out"
|
||||
// parameters.
|
||||
{
|
||||
NS_ASSERTION(rhs, "Null pointer passed to forget!");
|
||||
*rhs = 0;
|
||||
swap(*rhs);
|
||||
}
|
||||
|
||||
T*
|
||||
get() const
|
||||
/*
|
||||
|
@ -1139,6 +1150,16 @@ class nsCOMPtr<nsISupports>
|
|||
mRawPtr = temp;
|
||||
}
|
||||
|
||||
void
|
||||
forget( nsISupports** rhs )
|
||||
// Set the target of rhs to the value of mRawPtr and null out mRawPtr.
|
||||
// Useful to avoid unnecessary AddRef/Release pairs with "out"
|
||||
// parameters.
|
||||
{
|
||||
NS_ASSERTION(rhs, "Null pointer passed to forget!");
|
||||
*rhs = 0;
|
||||
swap(*rhs);
|
||||
}
|
||||
|
||||
// Other pointer operators
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче