mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
macOS: Add support for building clients with ARC enabled (fixes issue #2623).
Under ARC (Automatic Reference Counting), assigning to an Objective-C pointer has different semantics than assigning to a void* pointer. This makes it dangerous to treat the same memory address as an Objective-C pointer in some cases and as a "regular C pointer" in other cases. This change removes the conditional type defines and instead uses void* everywhere. Explicit type casting in combination with ARC annotations makes it safe to get typed Objective-C pointers from the void* pointers. This change enables ARC by default in the CEF binary distribution CMake configuration for the cefclient and cefsimple sample applications. It can be disabled by adding `-DOPTION_USE_ARC=Off` to the CMake command line. ARC is not supported when building Chromium due to the substantial number of changes that would be required in the Chromium code base.
This commit is contained in:
committed by
Marshall Greenblatt
parent
491253fa03
commit
019611c764
@@ -11,12 +11,19 @@
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#ifdef __OBJC__
|
||||
@class NSObject;
|
||||
#else
|
||||
class NSObject;
|
||||
#endif
|
||||
typedef NSObject CefNativeAccessible;
|
||||
typedef void CefNativeAccessible;
|
||||
#if __OBJC__
|
||||
#if __has_feature(objc_arc)
|
||||
#define CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT(accessible) \
|
||||
(__bridge NSObject*)accessible
|
||||
#define CAST_NSOBJECT_TO_CEF_NATIVE_ACCESSIBLE(object) \
|
||||
(__bridge CefNativeAccessible*)object
|
||||
#else // __has_feature(objc_arc)
|
||||
#define CAST_CEF_NATIVE_ACCESSIBLE_TO_NSOBJECT(accessible) (NSObject*)accessible
|
||||
#define CAST_NSOBJECT_TO_CEF_NATIVE_ACCESSIBLE(object) \
|
||||
(__bridge CefNativeAccessible*)object
|
||||
#endif // __has_feature(objc_arc)
|
||||
#endif // __OBJC__
|
||||
#elif defined(OS_WIN)
|
||||
struct IAccessible;
|
||||
typedef IAccessible CefNativeAccessible;
|
||||
|
Reference in New Issue
Block a user