electron/patches/common/chromium/backport_cd7154e0bb5.patch
Jeremy Apthorp 335caef9ad fix: support macos 10.14 SDK (#14758)
* support macos 10.14 SDK

* forward-declare NSUserActivityRestoring for backwards compatibility

* that didn't work, let's resort to #ifdef
2018-09-24 10:41:17 -04:00

100 lines
3.9 KiB
Diff

From 0dc7f85f52b9a5668481dfa206e6e55d40357cc2 Mon Sep 17 00:00:00 2001
From: Elly Fong-Jones <ellyjones@chromium.org>
Date: Wed, 6 Jun 2018 21:31:34 +0000
Subject: mac: support build with 10.14 SDK
Two changes are required:
1) Explicitly upcast the result of dispatch_get_global_queue() to a
dispatch_queue_t*, since it changed to return dispatch_queue_global_t*;
2) Add empty implementations of the new methods on ICCameraDeviceDelegate for
ImageCaptureDevice
TBR=maxmorin@chromium.org
Bug: 849689
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I9448d1b07f8d4116ecdb0c75a7796472e51c6dd8
Reviewed-on: https://chromium-review.googlesource.com/1087169
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565040}
diff --git a/components/storage_monitor/image_capture_device.mm b/components/storage_monitor/image_capture_device.mm
index af289bd66eb6..831cb65ac970 100644
--- a/components/storage_monitor/image_capture_device.mm
+++ b/components/storage_monitor/image_capture_device.mm
@@ -231,4 +231,38 @@ base::FilePath PathForCameraItem(ICCameraItem* item) {
name));
}
+// MacOS 10.14 SDK methods, not yet implemented (https://crbug.com/849689)
+- (void)cameraDevice:(ICCameraDevice*)camera
+ didRenameItems:(NSArray<ICCameraItem*>*)items {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDevice:(ICCameraDevice*)camera didRemoveItem:(ICCameraItem*)item {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDevice:(ICCameraDevice*)camera
+ didCompleteDeleteFilesWithError:(NSError*)error {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDeviceDidChangeCapability:(ICCameraDevice*)camera {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDevice:(ICCameraDevice*)camera
+ didReceiveThumbnailForItem:(ICCameraItem*)item {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDevice:(ICCameraDevice*)camera
+ didReceiveMetadataForItem:(ICCameraItem*)item {
+ NOTIMPLEMENTED();
+}
+
+- (void)cameraDevice:(ICCameraDevice*)camera
+ didReceivePTPEvent:(NSData*)eventData {
+ NOTIMPLEMENTED();
+}
+
@end // ImageCaptureDevice
diff --git a/media/audio/mac/coreaudio_dispatch_override.cc b/media/audio/mac/coreaudio_dispatch_override.cc
index 2ac812b0f3fc..34d1ad2a0fbe 100644
--- a/media/audio/mac/coreaudio_dispatch_override.cc
+++ b/media/audio/mac/coreaudio_dispatch_override.cc
@@ -22,6 +22,9 @@ struct dyld_interpose_tuple {
const void* replacement;
const void* replacee;
};
+
+using DispatchGetGlobalQueueFunc = dispatch_queue_t (*)(long id,
+ unsigned long flags);
} // namespace
// This method, and the tuple above, is defined in dyld_priv.h; see:
@@ -175,8 +178,13 @@ bool InitializeCoreAudioDispatchOverride() {
const auto* header = reinterpret_cast<const mach_header*>(info.dli_fbase);
g_pause_resume_queue =
dispatch_queue_create("org.chromium.CoreAudioPauseResumeQueue", nullptr);
- dyld_interpose_tuple interposition(&GetGlobalQueueOverride,
- &dispatch_get_global_queue);
+ // The reinterpret_cast<> is needed because in the macOS 10.14 SDK, the return
+ // type of dispatch_get_global_queue changed to return a subtype of
+ // dispatch_queue_t* instead of dispatch_queue_t* itself, and T(*)(...) isn't
+ // automatically converted to U(*)(...) even if U is a superclass of T.
+ dyld_interpose_tuple interposition(
+ &GetGlobalQueueOverride,
+ reinterpret_cast<DispatchGetGlobalQueueFunc>(&dispatch_get_global_queue));
dyld_dynamic_interpose(header, &interposition, 1);
g_dispatch_override_installed = true;
LogInitResult(RESULT_INITIALIZED);
--
2.17.0