/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
for (const nsString& name : affectedResourceNames) { if (auto queue = mManagedLocks->mQueueMap.Lookup(name)) {
ProcessRequestQueue(queue.Data());
}
}
mManagedLocks = nullptr; // We just decreased the refcount and potentially deleted it, so check whether // the weak pointer still points to anything and remove the entry if not. if (!sManagedLocksMap->Get(mPrincipal)) {
sManagedLocksMap->Remove(mPrincipal);
}
}
void LockManagerParent::ProcessRequestQueue(
nsTArray<RefPtr<LockRequestParent>>& aQueue) { while (aQueue.Length()) {
RefPtr<LockRequestParent> first = aQueue[0]; if (!IsGrantableRequest(first->Data())) { break;
}
aQueue.RemoveElementAt(0);
mManagedLocks->mHeldLocks.AppendElement(first);
(void)NS_WARN_IF(!first->SendResolve(first->Data().lockMode(), true));
}
}
bool LockManagerParent::IsGrantableRequest(const IPCLockRequest& aRequest) { for (constauto& held : mManagedLocks->mHeldLocks) { if (held->Data().name() == aRequest.name()) { if (aRequest.lockMode() == LockMode::Exclusive) { returnfalse;
}
MOZ_ASSERT(aRequest.lockMode() == LockMode::Shared); if (held->Data().lockMode() == LockMode::Exclusive) { returnfalse;
}
}
} returntrue;
}
IPCResult LockManagerParent::RecvQuery(QueryResolver&& aResolver) {
LockManagerSnapshot snapshot;
snapshot.mHeld.Construct();
snapshot.mPending.Construct(); for (constauto& queueMapEntry : mManagedLocks->mQueueMap) { for (const RefPtr<LockRequestParent>& request : queueMapEntry.GetData()) {
LockInfo info;
info.mMode.Construct(request->Data().lockMode());
info.mName.Construct(request->Data().name());
info.mClientId.Construct( static_cast<LockManagerParent*>(request->Manager())->mClientId); if (!snapshot.mPending.Value().AppendElement(info, mozilla::fallible)) { return IPC_FAIL(this, "Out of memory");
};
}
} for (const RefPtr<LockRequestParent>& request : mManagedLocks->mHeldLocks) {
LockInfo info;
info.mMode.Construct(request->Data().lockMode());
info.mName.Construct(request->Data().name());
info.mClientId.Construct( static_cast<LockManagerParent*>(request->Manager())->mClientId); if (!snapshot.mHeld.Value().AppendElement(info, mozilla::fallible)) { return IPC_FAIL(this, "Out of memory");
};
}
aResolver(snapshot); return IPC_OK();
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.