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
@@ -12,18 +12,10 @@
|
||||
#include "tests/cefclient/browser/browser_window.h"
|
||||
#include "tests/cefclient/browser/root_window.h"
|
||||
|
||||
#ifdef __OBJC__
|
||||
@class NSWindow;
|
||||
@class NSButton;
|
||||
@class NSTextField;
|
||||
#else
|
||||
class NSWindow;
|
||||
class NSButton;
|
||||
class NSTextField;
|
||||
#endif
|
||||
|
||||
namespace client {
|
||||
|
||||
class RootWindowMacImpl;
|
||||
|
||||
// OS X implementation of a top-level native window in the browser process.
|
||||
// The methods of this class must be called on the main thread unless otherwise
|
||||
// indicated.
|
||||
@@ -33,6 +25,9 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
RootWindowMac();
|
||||
~RootWindowMac();
|
||||
|
||||
BrowserWindow* browser_window() const;
|
||||
RootWindow::Delegate* delegate() const;
|
||||
|
||||
// RootWindow methods.
|
||||
void Init(RootWindow::Delegate* delegate,
|
||||
const RootWindowConfig& config,
|
||||
@@ -55,18 +50,6 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
bool WithWindowlessRendering() const OVERRIDE;
|
||||
bool WithExtension() const OVERRIDE;
|
||||
|
||||
// Called by RootWindowDelegate after the associated NSWindow has been
|
||||
// destroyed.
|
||||
void WindowDestroyed();
|
||||
|
||||
BrowserWindow* browser_window() const { return browser_window_.get(); }
|
||||
RootWindow::Delegate* delegate() const { return delegate_; }
|
||||
|
||||
private:
|
||||
void CreateBrowserWindow(const std::string& startup_url);
|
||||
void CreateRootWindow(const CefBrowserSettings& settings,
|
||||
bool initially_hidden);
|
||||
|
||||
// BrowserWindow::Delegate methods.
|
||||
void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
void OnBrowserWindowDestroyed() OVERRIDE;
|
||||
@@ -80,34 +63,14 @@ class RootWindowMac : public RootWindow, public BrowserWindow::Delegate {
|
||||
void OnSetDraggableRegions(
|
||||
const std::vector<CefDraggableRegion>& regions) OVERRIDE;
|
||||
|
||||
void NotifyDestroyedIfDone();
|
||||
void OnNativeWindowClosed();
|
||||
|
||||
// After initialization all members are only accessed on the main thread.
|
||||
// Members set during initialization.
|
||||
bool with_controls_;
|
||||
bool with_osr_;
|
||||
bool with_extension_;
|
||||
bool is_popup_;
|
||||
CefRect start_rect_;
|
||||
scoped_ptr<BrowserWindow> browser_window_;
|
||||
bool initialized_;
|
||||
|
||||
// Main window.
|
||||
NSWindow* window_;
|
||||
|
||||
// Buttons.
|
||||
NSButton* back_button_;
|
||||
NSButton* forward_button_;
|
||||
NSButton* reload_button_;
|
||||
NSButton* stop_button_;
|
||||
|
||||
// URL text field.
|
||||
NSTextField* url_textfield_;
|
||||
|
||||
bool window_destroyed_;
|
||||
bool browser_destroyed_;
|
||||
private:
|
||||
CefRefPtr<RootWindowMacImpl> impl_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(RootWindowMac);
|
||||
|
||||
friend class RootWindowMacImpl;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
Reference in New Issue
Block a user