Bug 1182408 - Part 1: Move permission key checks out of loop. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2015-07-14 10:53:12 -07:00
Родитель a1ff6f2c30
Коммит 6329372a9d
1 изменённых файлов: 7 добавлений и 10 удалений

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

@ -1603,15 +1603,13 @@ PLDHashOperator
nsPermissionManager::GetPermissionsForApp(nsPermissionManager::PermissionHashKey* entry, void* arg)
{
GetPermissionsForAppStruct* data = static_cast<GetPermissionsForAppStruct*>(arg);
if (entry->GetKey()->mAppId != data->appId ||
(data->browserOnly && !entry->GetKey()->mIsInBrowserElement)) {
return PL_DHASH_NEXT;
}
for (uint32_t i = 0; i < entry->GetPermissions().Length(); ++i) {
nsPermissionManager::PermissionEntry& permEntry = entry->GetPermissions()[i];
if (entry->GetKey()->mAppId != data->appId ||
(data->browserOnly && !entry->GetKey()->mIsInBrowserElement)) {
continue;
}
data->permissions.AppendObject(new nsPermission(entry->GetKey()->mHost,
entry->GetKey()->mAppId,
entry->GetKey()->mIsInBrowserElement,
@ -1692,12 +1690,11 @@ nsPermissionManager::RemoveExpiredPermissionsForAppEnumerator(
nsPermissionManager::PermissionHashKey* entry, void* arg)
{
uint32_t* appId = static_cast<uint32_t*>(arg);
if (entry->GetKey()->mAppId != *appId) {
return PL_DHASH_NEXT;
}
for (uint32_t i = 0; i < entry->GetPermissions().Length(); ++i) {
if (entry->GetKey()->mAppId != *appId) {
continue;
}
nsPermissionManager::PermissionEntry& permEntry = entry->GetPermissions()[i];
if (permEntry.mExpireType != nsIPermissionManager::EXPIRE_SESSION) {
continue;