mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1626437 - Remove nsAutoPtr usage from dom/cache. r=dom-workers-and-storage-reviewers,sg
Differential Revision: https://phabricator.services.mozilla.com/D69107 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
dc6eb9e628
commit
23071477d2
24
dom/cache/CacheStorage.cpp
vendored
24
dom/cache/CacheStorage.cpp
vendored
@ -333,7 +333,7 @@ already_AddRefed<Promise> CacheStorage::Match(
|
||||
CacheQueryParams params;
|
||||
ToCacheQueryParams(params, aOptions);
|
||||
|
||||
nsAutoPtr<Entry> entry(new Entry());
|
||||
auto entry = MakeUnique<Entry>();
|
||||
entry->mPromise = promise;
|
||||
entry->mArgs = StorageMatchArgs(CacheRequest(), params, GetOpenMode());
|
||||
entry->mRequest = request;
|
||||
@ -362,7 +362,7 @@ already_AddRefed<Promise> CacheStorage::Has(const nsAString& aKey,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<Entry> entry(new Entry());
|
||||
auto entry = MakeUnique<Entry>();
|
||||
entry->mPromise = promise;
|
||||
entry->mArgs = StorageHasArgs(nsString(aKey));
|
||||
|
||||
@ -390,7 +390,7 @@ already_AddRefed<Promise> CacheStorage::Open(const nsAString& aKey,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<Entry> entry(new Entry());
|
||||
auto entry = MakeUnique<Entry>();
|
||||
entry->mPromise = promise;
|
||||
entry->mArgs = StorageOpenArgs(nsString(aKey));
|
||||
|
||||
@ -418,7 +418,7 @@ already_AddRefed<Promise> CacheStorage::Delete(const nsAString& aKey,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<Entry> entry(new Entry());
|
||||
auto entry = MakeUnique<Entry>();
|
||||
entry->mPromise = promise;
|
||||
entry->mArgs = StorageDeleteArgs(nsString(aKey));
|
||||
|
||||
@ -445,7 +445,7 @@ already_AddRefed<Promise> CacheStorage::Keys(ErrorResult& aRv) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoPtr<Entry> entry(new Entry());
|
||||
auto entry = MakeUnique<Entry>();
|
||||
entry->mPromise = promise;
|
||||
entry->mArgs = StorageKeysArgs();
|
||||
|
||||
@ -540,23 +540,21 @@ CacheStorage::~CacheStorage() {
|
||||
}
|
||||
}
|
||||
|
||||
void CacheStorage::RunRequest(nsAutoPtr<Entry>&& aEntry) {
|
||||
void CacheStorage::RunRequest(UniquePtr<Entry> aEntry) {
|
||||
MOZ_ASSERT(mActor);
|
||||
|
||||
nsAutoPtr<Entry> entry(std::move(aEntry));
|
||||
AutoChildOpArgs args(this, aEntry->mArgs, 1);
|
||||
|
||||
AutoChildOpArgs args(this, entry->mArgs, 1);
|
||||
|
||||
if (entry->mRequest) {
|
||||
if (aEntry->mRequest) {
|
||||
ErrorResult rv;
|
||||
args.Add(entry->mRequest, IgnoreBody, IgnoreInvalidScheme, rv);
|
||||
args.Add(aEntry->mRequest, IgnoreBody, IgnoreInvalidScheme, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
entry->mPromise->MaybeReject(std::move(rv));
|
||||
aEntry->mPromise->MaybeReject(std::move(rv));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mActor->ExecuteOp(mGlobal, entry->mPromise, this, args.SendAsOpArgs());
|
||||
mActor->ExecuteOp(mGlobal, aEntry->mPromise, this, args.SendAsOpArgs());
|
||||
}
|
||||
|
||||
OpenMode CacheStorage::GetOpenMode() const {
|
||||
|
4
dom/cache/CacheStorage.h
vendored
4
dom/cache/CacheStorage.h
vendored
@ -7,9 +7,9 @@
|
||||
#ifndef mozilla_dom_cache_CacheStorage_h
|
||||
#define mozilla_dom_cache_CacheStorage_h
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/cache/Types.h"
|
||||
#include "mozilla/dom/cache/TypeUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsTArray.h"
|
||||
@ -91,7 +91,7 @@ class CacheStorage final : public nsISupports,
|
||||
~CacheStorage();
|
||||
|
||||
struct Entry;
|
||||
void RunRequest(nsAutoPtr<Entry>&& aEntry);
|
||||
void RunRequest(UniquePtr<Entry> aEntry);
|
||||
|
||||
OpenMode GetOpenMode() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user