Commit 58299c81 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Use @available to protect a reference to CIDetectorTypeQRCode.

An upcoming version of clang removes the ability to suppress
availability warnings by redeclaring functions. The new way
to suppress warnings is to either annotate the caller with an
availability attribute or enclose the function reference in an "if
(@available)" block.

This patch does the latter for a reference to
CIDetectorTypeQRCode (which requires 10.10) in the constructor for
BarcodeDetectionImplMac. A test relies on being able to construct this
object even on pre-10.10 systems, so we cannot use the availability
attribute or assert that we are 10.10 or higher.

Bug: 735328
Change-Id: I64883a34911b95e624b6ccb0f638034920aef75d
Reviewed-on: https://chromium-review.googlesource.com/565028
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485484}
parent cd4afb51
......@@ -37,9 +37,11 @@ void BarcodeDetectionImpl::Create(
BarcodeDetectionImplMac::BarcodeDetectionImplMac() {
NSDictionary* const options = @{CIDetectorAccuracy : CIDetectorAccuracyHigh};
detector_.reset([[CIDetector detectorOfType:CIDetectorTypeQRCode
context:nil
options:options] retain]);
if (@available(macOS 10.10, *)) {
detector_.reset([[CIDetector detectorOfType:CIDetectorTypeQRCode
context:nil
options:options] retain]);
}
}
BarcodeDetectionImplMac::~BarcodeDetectionImplMac() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment