Bug 1764370 - Use NS_GET_IID instead of NS_DEFINE_IID for PRIVATE_IDBREQUEST_IID. r=dom-workers-and-storage-reviewers,asuth

Create a new fake class so that NS_GET_IID can be used instead of
NS_DEFINE_IID.

Differential Revision: https://phabricator.services.mozilla.com/D143509
This commit is contained in:
Andrew McCreight 2022-04-20 21:09:27 +00:00
Родитель 467d2abfd0
Коммит 5ec46e3cef
3 изменённых файлов: 15 добавлений и 11 удалений

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

@ -41,12 +41,6 @@ namespace mozilla::dom {
using namespace mozilla::dom::indexedDB;
using namespace mozilla::ipc;
namespace {
NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID);
} // namespace
IDBRequest::IDBRequest(IDBDatabase* aDatabase)
: DOMEventTargetHelper(aDatabase),
mLoggingSerialNumber(0),
@ -302,7 +296,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(IDBRequest, DOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IDBRequest)
if (aIID.Equals(kIDBRequestIID)) {
if (aIID.Equals(NS_GET_IID(mozilla::dom::detail::PrivateIDBRequest))) {
foundInterface = this;
} else
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)

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

@ -45,6 +45,17 @@ struct Nullable;
class OwningIDBObjectStoreOrIDBIndexOrIDBCursor;
class StrongWorkerRef;
namespace detail {
// This class holds the IID for use with NS_GET_IID.
class PrivateIDBRequest {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(PRIVATE_IDBREQUEST_IID)
};
NS_DEFINE_STATIC_IID_ACCESSOR(PrivateIDBRequest, PRIVATE_IDBREQUEST_IID)
} // namespace detail
class IDBRequest : public DOMEventTargetHelper {
protected:
// mSourceAsObjectStore and mSourceAsIndex are exclusive and one must always

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

@ -105,8 +105,6 @@ using namespace mozilla::dom::indexedDB;
namespace {
NS_DEFINE_IID(kIDBPrivateRequestIID, PRIVATE_IDBREQUEST_IID);
// The threshold we use for structured clone data storing.
// Anything smaller than the threshold is compressed and stored in the database.
// Anything larger is compressed and stored outside the database.
@ -410,8 +408,9 @@ nsresult IndexedDatabaseManager::CommonPostHandleEvent(
// Only mess with events that were originally targeted to an IDBRequest.
RefPtr<IDBRequest> request;
if (NS_FAILED(eventTarget->QueryInterface(kIDBPrivateRequestIID,
getter_AddRefs(request))) ||
if (NS_FAILED(eventTarget->QueryInterface(
NS_GET_IID(mozilla::dom::detail::PrivateIDBRequest),
getter_AddRefs(request))) ||
!request) {
return NS_OK;
}