Commit 9c85ac23 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Use @available to protect references to NS45Notification.

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 uses @available to protect references to
NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification,
instead of comparing its address to zero.

Bug: 735328
Change-Id: If6f428da62c1486c1d608f0afe5637f9fb2f4e07
Reviewed-on: https://chromium-review.googlesource.com/564151Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485315}
parent b5dc585c
......@@ -242,7 +242,7 @@ CGFloat LineWidthFromContext(CGContextRef context) {
[self setWantsLayer:YES]; // -drawFill: needs a layer.
if (&NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification) {
if (@available(macOS 10.10, *)) {
NSNotificationCenter* center =
[[NSWorkspace sharedWorkspace] notificationCenter];
[center
......@@ -259,7 +259,7 @@ CGFloat LineWidthFromContext(CGContextRef context) {
- (void)dealloc {
// Cancel any delayed requests that may still be pending (drags or hover).
[NSObject cancelPreviousPerformRequestsWithTarget:self];
if (&NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification) {
if (@available(macOS 10.10, *)) {
NSNotificationCenter* center =
[[NSWorkspace sharedWorkspace] notificationCenter];
[center removeObserver:self];
......
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