Bug 1600283 - Remove uses of already_AddRefed. r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D55483

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2019-12-16 13:18:06 +00:00
Родитель f663797d53
Коммит f35b7713ac
4 изменённых файлов: 54 добавлений и 53 удалений

Просмотреть файл

@ -320,7 +320,7 @@ RefPtr<IDBRequest> IDBIndex::GetInternal(bool aKeyOnly, JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -396,7 +396,7 @@ RefPtr<IDBRequest> IDBIndex::GetAllInternal(bool aKeysOnly, JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -472,7 +472,7 @@ RefPtr<IDBRequest> IDBIndex::OpenCursorInternal(bool aKeysOnly, JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aRange, &keyRange, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -553,7 +553,7 @@ RefPtr<IDBRequest> IDBIndex::Count(JSContext* aCx, JS::Handle<JS::Value> aKey,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (aRv.Failed()) {
return nullptr;
}

Просмотреть файл

@ -63,14 +63,15 @@ IDBLocaleAwareKeyRange::~IDBLocaleAwareKeyRange() { DropJSObjects(); }
// static
void IDBKeyRange::FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal,
IDBKeyRange** aKeyRange, ErrorResult& aRv) {
RefPtr<IDBKeyRange>* aKeyRange, ErrorResult& aRv) {
MOZ_ASSERT_IF(!aCx, aVal.isUndefined());
MOZ_ASSERT(aKeyRange);
RefPtr<IDBKeyRange> keyRange;
if (aVal.isNullOrUndefined()) {
// undefined and null returns no IDBKeyRange.
keyRange.forget(aKeyRange);
*aKeyRange = std::move(keyRange);
return;
}
@ -79,7 +80,7 @@ void IDBKeyRange::FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal,
// Unwrap an IDBKeyRange object if possible.
if (obj && NS_SUCCEEDED(UNWRAP_OBJECT(IDBKeyRange, obj, keyRange))) {
MOZ_ASSERT(keyRange);
keyRange.forget(aKeyRange);
*aKeyRange = std::move(keyRange);
return;
}
@ -87,12 +88,12 @@ void IDBKeyRange::FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal,
keyRange = new IDBKeyRange(nullptr, false, false, true);
GetKeyFromJSVal(aCx, aVal, keyRange->Lower(), aRv);
if (!aRv.Failed()) {
keyRange.forget(aKeyRange);
*aKeyRange = std::move(keyRange);
}
}
// static
already_AddRefed<IDBKeyRange> IDBKeyRange::FromSerialized(
RefPtr<IDBKeyRange> IDBKeyRange::FromSerialized(
const SerializedKeyRange& aKeyRange) {
RefPtr<IDBKeyRange> keyRange =
new IDBKeyRange(nullptr, aKeyRange.lowerOpen(), aKeyRange.upperOpen(),
@ -101,7 +102,7 @@ already_AddRefed<IDBKeyRange> IDBKeyRange::FromSerialized(
if (!keyRange->IsOnly()) {
keyRange->Upper() = aKeyRange.upper();
}
return keyRange.forget();
return keyRange;
}
void IDBKeyRange::ToSerialized(SerializedKeyRange& aKeyRange) const {
@ -249,9 +250,9 @@ bool IDBKeyRange::Includes(JSContext* aCx, JS::Handle<JS::Value> aValue,
}
// static
already_AddRefed<IDBKeyRange> IDBKeyRange::Only(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> IDBKeyRange::Only(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> keyRange =
new IDBKeyRange(aGlobal.GetAsSupports(), false, false, true);
@ -260,13 +261,13 @@ already_AddRefed<IDBKeyRange> IDBKeyRange::Only(const GlobalObject& aGlobal,
return nullptr;
}
return keyRange.forget();
return keyRange;
}
// static
already_AddRefed<IDBKeyRange> IDBKeyRange::LowerBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> IDBKeyRange::LowerBound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
bool aOpen, ErrorResult& aRv) {
RefPtr<IDBKeyRange> keyRange =
new IDBKeyRange(aGlobal.GetAsSupports(), aOpen, true, false);
@ -275,13 +276,13 @@ already_AddRefed<IDBKeyRange> IDBKeyRange::LowerBound(
return nullptr;
}
return keyRange.forget();
return keyRange;
}
// static
already_AddRefed<IDBKeyRange> IDBKeyRange::UpperBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> IDBKeyRange::UpperBound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
bool aOpen, ErrorResult& aRv) {
RefPtr<IDBKeyRange> keyRange =
new IDBKeyRange(aGlobal.GetAsSupports(), true, aOpen, false);
@ -290,16 +291,15 @@ already_AddRefed<IDBKeyRange> IDBKeyRange::UpperBound(
return nullptr;
}
return keyRange.forget();
return keyRange;
}
// static
already_AddRefed<IDBKeyRange> IDBKeyRange::Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen,
bool aUpperOpen,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> IDBKeyRange::Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv) {
RefPtr<IDBKeyRange> keyRange =
new IDBKeyRange(aGlobal.GetAsSupports(), aLowerOpen, aUpperOpen, false);
@ -319,11 +319,11 @@ already_AddRefed<IDBKeyRange> IDBKeyRange::Bound(const GlobalObject& aGlobal,
return nullptr;
}
return keyRange.forget();
return keyRange;
}
// static
already_AddRefed<IDBLocaleAwareKeyRange> IDBLocaleAwareKeyRange::Bound(
RefPtr<IDBLocaleAwareKeyRange> IDBLocaleAwareKeyRange::Bound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper, bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv) {
@ -345,7 +345,7 @@ already_AddRefed<IDBLocaleAwareKeyRange> IDBLocaleAwareKeyRange::Bound(
return nullptr;
}
return keyRange.forget();
return keyRange;
}
} // namespace dom

Просмотреть файл

@ -52,28 +52,29 @@ class IDBKeyRange : public nsISupports {
// aCx is allowed to be null, but only if aVal.isUndefined().
static void FromJSVal(JSContext* aCx, JS::Handle<JS::Value> aVal,
IDBKeyRange** aKeyRange, ErrorResult& aRv);
RefPtr<IDBKeyRange>* aKeyRange, ErrorResult& aRv);
static already_AddRefed<IDBKeyRange> FromSerialized(
static MOZ_MUST_USE RefPtr<IDBKeyRange> FromSerialized(
const indexedDB::SerializedKeyRange& aKeyRange);
static already_AddRefed<IDBKeyRange> Only(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> Only(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
ErrorResult& aRv);
static already_AddRefed<IDBKeyRange> LowerBound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
bool aOpen, ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> LowerBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
static already_AddRefed<IDBKeyRange> UpperBound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aValue,
bool aOpen, ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> UpperBound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aValue, bool aOpen,
ErrorResult& aRv);
static already_AddRefed<IDBKeyRange> Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv);
static MOZ_MUST_USE RefPtr<IDBKeyRange> Bound(const GlobalObject& aGlobal,
JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper,
bool aLowerOpen,
bool aUpperOpen,
ErrorResult& aRv);
void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(IDBKeyRange); }
@ -124,7 +125,7 @@ class IDBLocaleAwareKeyRange final : public IDBKeyRange {
~IDBLocaleAwareKeyRange();
public:
static already_AddRefed<IDBLocaleAwareKeyRange> Bound(
static MOZ_MUST_USE RefPtr<IDBLocaleAwareKeyRange> Bound(
const GlobalObject& aGlobal, JS::Handle<JS::Value> aLower,
JS::Handle<JS::Value> aUpper, bool aLowerOpen, bool aUpperOpen,
ErrorResult& aRv);

Просмотреть файл

@ -1698,7 +1698,7 @@ RefPtr<IDBRequest> IDBObjectStore::GetAllInternal(
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
@ -2019,7 +2019,7 @@ RefPtr<IDBRequest> IDBObjectStore::GetInternal(bool aKeyOnly, JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (aRv.Failed()) {
return nullptr;
}
@ -2082,7 +2082,7 @@ RefPtr<IDBRequest> IDBObjectStore::DeleteInternal(JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (NS_WARN_IF((aRv.Failed()))) {
return nullptr;
}
@ -2308,7 +2308,7 @@ RefPtr<IDBRequest> IDBObjectStore::Count(JSContext* aCx,
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aKey, &keyRange, aRv);
if (aRv.Failed()) {
return nullptr;
}
@ -2360,7 +2360,7 @@ RefPtr<IDBRequest> IDBObjectStore::OpenCursorInternal(
}
RefPtr<IDBKeyRange> keyRange;
IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange), aRv);
IDBKeyRange::FromJSVal(aCx, aRange, &keyRange, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}