Commit a0cb3f44 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Commit Bot

Use @available in service_process_util_mac.mm.

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 changes service_process_util_mac.mm to use the
SDK's definition of the getRelationship function instead of a
redeclaration and protect the call with an @available check instead
of respondsToSelector.

Bug: 735328
Change-Id: I2097b2343f63b74cbc198e7cf7bcaabea2e45735
Reviewed-on: https://chromium-review.googlesource.com/564308Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485395}
parent fc5c81e4
...@@ -29,14 +29,6 @@ ...@@ -29,14 +29,6 @@
#include "components/version_info/version_info.h" #include "components/version_info/version_info.h"
#include "mojo/edk/embedder/named_platform_handle_utils.h" #include "mojo/edk/embedder/named_platform_handle_utils.h"
@interface NSFileManager (YosemiteSDK)
- (BOOL)getRelationship:(NSURLRelationship*)outRelationship
ofDirectory:(NSSearchPathDirectory)directory
inDomain:(NSSearchPathDomainMask)domainMask
toItemAtURL:(NSURL*)url
error:(NSError**)error;
@end
using ::base::FilePathWatcher; using ::base::FilePathWatcher;
namespace { namespace {
...@@ -363,11 +355,7 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path, ...@@ -363,11 +355,7 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path,
// 10.8, but didn't add getRelationship:... until 10.10. So fall back to // 10.8, but didn't add getRelationship:... until 10.10. So fall back to
// the deprecated function while running on 10.9 (and delete the else block // the deprecated function while running on 10.9 (and delete the else block
// when Chromium requires OS X 10.10+). // when Chromium requires OS X 10.10+).
if ([file_manager respondsToSelector:@selector(getRelationship: if (@available(macOS 10.10, *)) {
ofDirectory:
inDomain:
toItemAtURL:
error:)]) {
NSURLRelationship relationship; NSURLRelationship relationship;
if ([file_manager getRelationship:&relationship if ([file_manager getRelationship:&relationship
ofDirectory:NSTrashDirectory ofDirectory:NSTrashDirectory
......
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