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:
Jesper Papmehl-Dufay
2019-04-23 17:17:56 +00:00
committed by Marshall Greenblatt
parent 491253fa03
commit 019611c764
22 changed files with 1414 additions and 980 deletions

View File

@@ -13,6 +13,8 @@
namespace client {
class BrowserWindowOsrMacImpl;
// Represents a native child window hosting a single off-screen browser
// instance. The methods of this class must be called on the main thread unless
// otherwise indicated.
@@ -88,17 +90,11 @@ class BrowserWindowOsrMac : public BrowserWindow,
void UpdateAccessibilityLocation(CefRefPtr<CefValue> value) OVERRIDE;
private:
// Create the NSView.
void Create(ClientWindowHandle parent_handle, const CefRect& rect);
// The below members will only be accessed on the main thread which should be
// the same as the CEF UI thread.
OsrRenderer renderer_;
ClientWindowHandle nsview_;
bool hidden_;
bool painting_popup_;
scoped_ptr<BrowserWindowOsrMacImpl> impl_;
DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrMac);
friend class BrowserWindowOsrMacImpl;
};
} // namespace client