Bug 1535397 - Part 4 - use native Maybe syntax in place of NullableVersion in IDPL; r=baku

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Gaynor 2019-03-15 17:10:29 +00:00
parent e226477611
commit d3444f6ef7
4 changed files with 15 additions and 30 deletions

View File

@ -2053,7 +2053,7 @@ bool BackgroundDatabaseChild::DeallocPBackgroundMutableFileChild(
}
mozilla::ipc::IPCResult BackgroundDatabaseChild::RecvVersionChange(
const uint64_t& aOldVersion, const NullableVersion& aNewVersion) {
const uint64_t& aOldVersion, const Maybe<uint64_t>& aNewVersion) {
AssertIsOnOwningThread();
MaybeCollectGarbageOnIPCMessage();
@ -2092,21 +2092,14 @@ mozilla::ipc::IPCResult BackgroundDatabaseChild::RecvVersionChange(
RefPtr<Event> versionChangeEvent;
switch (aNewVersion.type()) {
case NullableVersion::Tnull_t:
versionChangeEvent =
IDBVersionChangeEvent::Create(kungFuDeathGrip, type, aOldVersion);
MOZ_ASSERT(versionChangeEvent);
break;
case NullableVersion::Tuint64_t:
versionChangeEvent = IDBVersionChangeEvent::Create(
kungFuDeathGrip, type, aOldVersion, aNewVersion.get_uint64_t());
MOZ_ASSERT(versionChangeEvent);
break;
default:
MOZ_CRASH("Should never get here!");
if (aNewVersion.isNothing()) {
versionChangeEvent =
IDBVersionChangeEvent::Create(kungFuDeathGrip, type, aOldVersion);
MOZ_ASSERT(versionChangeEvent);
} else {
versionChangeEvent = IDBVersionChangeEvent::Create(
kungFuDeathGrip, type, aOldVersion, aNewVersion.value());
MOZ_ASSERT(versionChangeEvent);
}
IDB_LOG_MARK("IndexedDB %s: Child : Firing \"versionchange\" event",

View File

@ -351,7 +351,7 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild {
PBackgroundMutableFileChild* aActor) override;
virtual mozilla::ipc::IPCResult RecvVersionChange(
const uint64_t& aOldVersion, const NullableVersion& aNewVersion) override;
const uint64_t& aOldVersion, const Maybe<uint64_t>& aNewVersion) override;
virtual mozilla::ipc::IPCResult RecvInvalidate() override;

View File

@ -6600,7 +6600,7 @@ class FactoryOp : public DatabaseOperationBase,
nsresult SendVersionChangeMessages(DatabaseActorInfo* aDatabaseActorInfo,
Database* aOpeningDatabase,
uint64_t aOldVersion,
const NullableVersion& aNewVersion);
const Maybe<uint64_t>& aNewVersion);
// Methods that subclasses must implement.
virtual nsresult DatabaseOpen() = 0;
@ -19394,7 +19394,7 @@ nsresult FactoryOp::CheckPermission(
nsresult FactoryOp::SendVersionChangeMessages(
DatabaseActorInfo* aDatabaseActorInfo, Database* aOpeningDatabase,
uint64_t aOldVersion, const NullableVersion& aNewVersion) {
uint64_t aOldVersion, const Maybe<uint64_t>& aNewVersion) {
AssertIsOnOwningThread();
MOZ_ASSERT(aDatabaseActorInfo);
MOZ_ASSERT(mState == State::BeginVersionChange);
@ -20426,7 +20426,7 @@ nsresult OpenDatabaseOp::BeginVersionChange() {
MOZ_ASSERT(info->mMetadata != mMetadata);
mMetadata = info->mMetadata;
NullableVersion newVersion = mRequestedVersion;
Maybe<uint64_t> newVersion = Some(mRequestedVersion);
nsresult rv = SendVersionChangeMessages(
info, mDatabase, mMetadata->mCommonMetadata.version(), newVersion);
@ -21185,10 +21185,8 @@ nsresult DeleteDatabaseOp::BeginVersionChange() {
if (gLiveDatabaseHashtable->Get(mDatabaseId, &info)) {
MOZ_ASSERT(!info->mWaitingFactoryOp);
NullableVersion newVersion = null_t();
nsresult rv =
SendVersionChangeMessages(info, nullptr, mPreviousVersion, newVersion);
SendVersionChangeMessages(info, nullptr, mPreviousVersion, Nothing());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

View File

@ -40,12 +40,6 @@ union DatabaseRequestParams
CreateFileParams;
};
union NullableVersion
{
null_t;
uint64_t;
};
sync protocol PBackgroundIDBDatabase
{
manager PBackgroundIDBFactory;
@ -72,7 +66,7 @@ parent:
child:
async __delete__();
async VersionChange(uint64_t oldVersion, NullableVersion newVersion);
async VersionChange(uint64_t oldVersion, uint64_t? newVersion);
async Invalidate();