Bug 1713528 - Change 'else if' after return to 'if'. r=aosmond

Differential Revision: https://phabricator.services.mozilla.com/D117197
This commit is contained in:
Jakob Spahn 2021-06-09 07:23:39 +00:00
parent 95c6e30135
commit 0b6e79fe0d

View File

@ -315,44 +315,63 @@ static void RemovePrefForDriverVersion() {
static OperatingSystem BlocklistOSToOperatingSystem(const nsAString& os) {
if (os.EqualsLiteral("WINNT 6.1")) {
return OperatingSystem::Windows7;
} else if (os.EqualsLiteral("WINNT 6.2")) {
}
if (os.EqualsLiteral("WINNT 6.2")) {
return OperatingSystem::Windows8;
} else if (os.EqualsLiteral("WINNT 6.3")) {
}
if (os.EqualsLiteral("WINNT 6.3")) {
return OperatingSystem::Windows8_1;
} else if (os.EqualsLiteral("WINNT 10.0")) {
}
if (os.EqualsLiteral("WINNT 10.0")) {
return OperatingSystem::Windows10;
} else if (os.EqualsLiteral("Linux")) {
}
if (os.EqualsLiteral("Linux")) {
return OperatingSystem::Linux;
} else if (os.EqualsLiteral("Darwin 9")) {
}
if (os.EqualsLiteral("Darwin 9")) {
return OperatingSystem::OSX10_5;
} else if (os.EqualsLiteral("Darwin 10")) {
}
if (os.EqualsLiteral("Darwin 10")) {
return OperatingSystem::OSX10_6;
} else if (os.EqualsLiteral("Darwin 11")) {
}
if (os.EqualsLiteral("Darwin 11")) {
return OperatingSystem::OSX10_7;
} else if (os.EqualsLiteral("Darwin 12")) {
}
if (os.EqualsLiteral("Darwin 12")) {
return OperatingSystem::OSX10_8;
} else if (os.EqualsLiteral("Darwin 13")) {
}
if (os.EqualsLiteral("Darwin 13")) {
return OperatingSystem::OSX10_9;
} else if (os.EqualsLiteral("Darwin 14")) {
}
if (os.EqualsLiteral("Darwin 14")) {
return OperatingSystem::OSX10_10;
} else if (os.EqualsLiteral("Darwin 15")) {
}
if (os.EqualsLiteral("Darwin 15")) {
return OperatingSystem::OSX10_11;
} else if (os.EqualsLiteral("Darwin 16")) {
}
if (os.EqualsLiteral("Darwin 16")) {
return OperatingSystem::OSX10_12;
} else if (os.EqualsLiteral("Darwin 17")) {
}
if (os.EqualsLiteral("Darwin 17")) {
return OperatingSystem::OSX10_13;
} else if (os.EqualsLiteral("Darwin 18")) {
}
if (os.EqualsLiteral("Darwin 18")) {
return OperatingSystem::OSX10_14;
} else if (os.EqualsLiteral("Darwin 19")) {
}
if (os.EqualsLiteral("Darwin 19")) {
return OperatingSystem::OSX10_15;
} else if (os.EqualsLiteral("Darwin 20")) {
}
if (os.EqualsLiteral("Darwin 20")) {
return OperatingSystem::OSX11_0;
} else if (os.EqualsLiteral("Android")) {
}
if (os.EqualsLiteral("Android")) {
return OperatingSystem::Android;
// For historical reasons, "All" in blocklist means "All Windows"
} else if (os.EqualsLiteral("All")) {
}
if (os.EqualsLiteral("All")) {
return OperatingSystem::Windows;
} else if (os.EqualsLiteral("Darwin")) {
}
if (os.EqualsLiteral("Darwin")) {
return OperatingSystem::OSX;
}
@ -378,68 +397,98 @@ static GfxDeviceFamily* BlocklistDevicesToDeviceFamily(
static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
MOZ_ASSERT(!aFeature.IsEmpty());
if (aFeature.EqualsLiteral("DIRECT2D"))
if (aFeature.EqualsLiteral("DIRECT2D")) {
return nsIGfxInfo::FEATURE_DIRECT2D;
else if (aFeature.EqualsLiteral("DIRECT3D_9_LAYERS"))
}
if (aFeature.EqualsLiteral("DIRECT3D_9_LAYERS")) {
return nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS;
else if (aFeature.EqualsLiteral("DIRECT3D_10_LAYERS"))
}
if (aFeature.EqualsLiteral("DIRECT3D_10_LAYERS")) {
return nsIGfxInfo::FEATURE_DIRECT3D_10_LAYERS;
else if (aFeature.EqualsLiteral("DIRECT3D_10_1_LAYERS"))
}
if (aFeature.EqualsLiteral("DIRECT3D_10_1_LAYERS")) {
return nsIGfxInfo::FEATURE_DIRECT3D_10_1_LAYERS;
else if (aFeature.EqualsLiteral("DIRECT3D_11_LAYERS"))
}
if (aFeature.EqualsLiteral("DIRECT3D_11_LAYERS")) {
return nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS;
else if (aFeature.EqualsLiteral("DIRECT3D_11_ANGLE"))
}
if (aFeature.EqualsLiteral("DIRECT3D_11_ANGLE")) {
return nsIGfxInfo::FEATURE_DIRECT3D_11_ANGLE;
else if (aFeature.EqualsLiteral("HARDWARE_VIDEO_DECODING"))
}
if (aFeature.EqualsLiteral("HARDWARE_VIDEO_DECODING")) {
return nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING;
else if (aFeature.EqualsLiteral("OPENGL_LAYERS"))
}
if (aFeature.EqualsLiteral("OPENGL_LAYERS")) {
return nsIGfxInfo::FEATURE_OPENGL_LAYERS;
else if (aFeature.EqualsLiteral("WEBGL_OPENGL"))
}
if (aFeature.EqualsLiteral("WEBGL_OPENGL")) {
return nsIGfxInfo::FEATURE_WEBGL_OPENGL;
else if (aFeature.EqualsLiteral("WEBGL_ANGLE"))
}
if (aFeature.EqualsLiteral("WEBGL_ANGLE")) {
return nsIGfxInfo::FEATURE_WEBGL_ANGLE;
else if (aFeature.EqualsLiteral("WEBGL_MSAA"))
}
if (aFeature.EqualsLiteral("WEBGL_MSAA")) {
return nsIGfxInfo::UNUSED_FEATURE_WEBGL_MSAA;
else if (aFeature.EqualsLiteral("STAGEFRIGHT"))
}
if (aFeature.EqualsLiteral("STAGEFRIGHT")) {
return nsIGfxInfo::FEATURE_STAGEFRIGHT;
else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_ENCODE"))
}
if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_ENCODE")) {
return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_ENCODE;
else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_DECODE"))
}
if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_DECODE")) {
return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_DECODE;
else if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_H264"))
}
if (aFeature.EqualsLiteral("WEBRTC_HW_ACCELERATION_H264")) {
return nsIGfxInfo::FEATURE_WEBRTC_HW_ACCELERATION_H264;
else if (aFeature.EqualsLiteral("CANVAS2D_ACCELERATION"))
}
if (aFeature.EqualsLiteral("CANVAS2D_ACCELERATION")) {
return nsIGfxInfo::FEATURE_CANVAS2D_ACCELERATION;
else if (aFeature.EqualsLiteral("DX_INTEROP2"))
}
if (aFeature.EqualsLiteral("DX_INTEROP2")) {
return nsIGfxInfo::FEATURE_DX_INTEROP2;
else if (aFeature.EqualsLiteral("GPU_PROCESS"))
}
if (aFeature.EqualsLiteral("GPU_PROCESS")) {
return nsIGfxInfo::FEATURE_GPU_PROCESS;
else if (aFeature.EqualsLiteral("WEBGL2"))
}
if (aFeature.EqualsLiteral("WEBGL2")) {
return nsIGfxInfo::FEATURE_WEBGL2;
else if (aFeature.EqualsLiteral("D3D11_KEYED_MUTEX"))
}
if (aFeature.EqualsLiteral("D3D11_KEYED_MUTEX")) {
return nsIGfxInfo::FEATURE_D3D11_KEYED_MUTEX;
else if (aFeature.EqualsLiteral("WEBRENDER"))
}
if (aFeature.EqualsLiteral("WEBRENDER")) {
return nsIGfxInfo::FEATURE_WEBRENDER;
else if (aFeature.EqualsLiteral("WEBRENDER_COMPOSITOR"))
}
if (aFeature.EqualsLiteral("WEBRENDER_COMPOSITOR")) {
return nsIGfxInfo::FEATURE_WEBRENDER_COMPOSITOR;
else if (aFeature.EqualsLiteral("DX_NV12"))
}
if (aFeature.EqualsLiteral("DX_NV12")) {
return nsIGfxInfo::FEATURE_DX_NV12;
}
// We do not support FEATURE_VP8_HW_DECODE and FEATURE_VP9_HW_DECODE
// in downloadable blocklist.
else if (aFeature.EqualsLiteral("GL_SWIZZLE"))
if (aFeature.EqualsLiteral("GL_SWIZZLE")) {
return nsIGfxInfo::FEATURE_GL_SWIZZLE;
else if (aFeature.EqualsLiteral("WEBRENDER_SCISSORED_CACHE_CLEARS"))
}
if (aFeature.EqualsLiteral("WEBRENDER_SCISSORED_CACHE_CLEARS")) {
return nsIGfxInfo::FEATURE_WEBRENDER_SCISSORED_CACHE_CLEARS;
else if (aFeature.EqualsLiteral("ALLOW_WEBGL_OUT_OF_PROCESS"))
}
if (aFeature.EqualsLiteral("ALLOW_WEBGL_OUT_OF_PROCESS")) {
return nsIGfxInfo::FEATURE_ALLOW_WEBGL_OUT_OF_PROCESS;
else if (aFeature.EqualsLiteral("THREADSAFE_GL"))
}
if (aFeature.EqualsLiteral("THREADSAFE_GL")) {
return nsIGfxInfo::FEATURE_THREADSAFE_GL;
else if (aFeature.EqualsLiteral("WEBRENDER_SOFTWARE"))
}
if (aFeature.EqualsLiteral("WEBRENDER_SOFTWARE")) {
return nsIGfxInfo::FEATURE_WEBRENDER_SOFTWARE;
else if (aFeature.EqualsLiteral("X11_EGL"))
}
if (aFeature.EqualsLiteral("X11_EGL")) {
return nsIGfxInfo::FEATURE_X11_EGL;
else if (aFeature.EqualsLiteral("DMABUF"))
}
if (aFeature.EqualsLiteral("DMABUF")) {
return nsIGfxInfo::FEATURE_DMABUF;
}
// If we don't recognize the feature, it may be new, and something
// this version doesn't understand. So, nothing to do. This is
@ -451,22 +500,30 @@ static int32_t BlocklistFeatureToGfxFeature(const nsAString& aFeature) {
static int32_t BlocklistFeatureStatusToGfxFeatureStatus(
const nsAString& aStatus) {
if (aStatus.EqualsLiteral("STATUS_OK"))
if (aStatus.EqualsLiteral("STATUS_OK")) {
return nsIGfxInfo::FEATURE_STATUS_OK;
else if (aStatus.EqualsLiteral("BLOCKED_DRIVER_VERSION"))
}
if (aStatus.EqualsLiteral("BLOCKED_DRIVER_VERSION")) {
return nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION;
else if (aStatus.EqualsLiteral("BLOCKED_DEVICE"))
}
if (aStatus.EqualsLiteral("BLOCKED_DEVICE")) {
return nsIGfxInfo::FEATURE_BLOCKED_DEVICE;
else if (aStatus.EqualsLiteral("DISCOURAGED"))
}
if (aStatus.EqualsLiteral("DISCOURAGED")) {
return nsIGfxInfo::FEATURE_DISCOURAGED;
else if (aStatus.EqualsLiteral("BLOCKED_OS_VERSION"))
}
if (aStatus.EqualsLiteral("BLOCKED_OS_VERSION")) {
return nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;
else if (aStatus.EqualsLiteral("DENIED"))
}
if (aStatus.EqualsLiteral("DENIED")) {
return nsIGfxInfo::FEATURE_DENIED;
else if (aStatus.EqualsLiteral("ALLOW_QUALIFIED"))
}
if (aStatus.EqualsLiteral("ALLOW_QUALIFIED")) {
return nsIGfxInfo::FEATURE_ALLOW_QUALIFIED;
else if (aStatus.EqualsLiteral("ALLOW_ALWAYS"))
}
if (aStatus.EqualsLiteral("ALLOW_ALWAYS")) {
return nsIGfxInfo::FEATURE_ALLOW_ALWAYS;
}
// Do not allow it to set STATUS_UNKNOWN. Also, we are not
// expecting the "mismatch" status showing up here.
@ -476,28 +533,39 @@ static int32_t BlocklistFeatureStatusToGfxFeatureStatus(
static VersionComparisonOp BlocklistComparatorToComparisonOp(
const nsAString& op) {
if (op.EqualsLiteral("LESS_THAN"))
if (op.EqualsLiteral("LESS_THAN")) {
return DRIVER_LESS_THAN;
else if (op.EqualsLiteral("BUILD_ID_LESS_THAN"))
}
if (op.EqualsLiteral("BUILD_ID_LESS_THAN")) {
return DRIVER_BUILD_ID_LESS_THAN;
else if (op.EqualsLiteral("LESS_THAN_OR_EQUAL"))
}
if (op.EqualsLiteral("LESS_THAN_OR_EQUAL")) {
return DRIVER_LESS_THAN_OR_EQUAL;
else if (op.EqualsLiteral("BUILD_ID_LESS_THAN_OR_EQUAL"))
}
if (op.EqualsLiteral("BUILD_ID_LESS_THAN_OR_EQUAL")) {
return DRIVER_BUILD_ID_LESS_THAN_OR_EQUAL;
else if (op.EqualsLiteral("GREATER_THAN"))
}
if (op.EqualsLiteral("GREATER_THAN")) {
return DRIVER_GREATER_THAN;
else if (op.EqualsLiteral("GREATER_THAN_OR_EQUAL"))
}
if (op.EqualsLiteral("GREATER_THAN_OR_EQUAL")) {
return DRIVER_GREATER_THAN_OR_EQUAL;
else if (op.EqualsLiteral("EQUAL"))
}
if (op.EqualsLiteral("EQUAL")) {
return DRIVER_EQUAL;
else if (op.EqualsLiteral("NOT_EQUAL"))
}
if (op.EqualsLiteral("NOT_EQUAL")) {
return DRIVER_NOT_EQUAL;
else if (op.EqualsLiteral("BETWEEN_EXCLUSIVE"))
}
if (op.EqualsLiteral("BETWEEN_EXCLUSIVE")) {
return DRIVER_BETWEEN_EXCLUSIVE;
else if (op.EqualsLiteral("BETWEEN_INCLUSIVE"))
}
if (op.EqualsLiteral("BETWEEN_INCLUSIVE")) {
return DRIVER_BETWEEN_INCLUSIVE;
else if (op.EqualsLiteral("BETWEEN_INCLUSIVE_START"))
}
if (op.EqualsLiteral("BETWEEN_INCLUSIVE_START")) {
return DRIVER_BETWEEN_INCLUSIVE_START;
}
return DRIVER_COMPARISON_IGNORED;
}
@ -701,7 +769,9 @@ GfxInfoBase::GetFeatureStatus(int32_t aFeature, nsACString& aFailureId,
*aStatus = FEATURE_BLOCKED_DEVICE;
aFailureId = "FEATURE_FAILURE_BLOCK_ALL";
return NS_OK;
} else if (blocklistAll < 0) {
}
if (blocklistAll < 0) {
gfxCriticalErrorOnce(gfxCriticalError::DefaultOptions(false))
<< "Ignoring any feature blocklisting.";
*aStatus = FEATURE_STATUS_OK;