cef/tests/cefclient/browser/temp_window_mac.h
Jesper Papmehl-Dufay 019611c764 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.
2019-04-23 17:17:56 +00:00

39 lines
1.0 KiB
C++

// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_TEMP_WINDOW_MAC_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_TEMP_WINDOW_MAC_H_
#pragma once
#include "tests/cefclient/browser/client_types.h"
namespace client {
class TempWindowMacImpl;
// Represents a singleton hidden window that acts as a temporary parent for
// popup browsers. Only accessed on the UI thread.
class TempWindowMac {
public:
// Returns the singleton window handle.
static CefWindowHandle GetWindowHandle();
private:
// A single instance will be created/owned by RootWindowManager.
friend class RootWindowManager;
// Allow deletion via scoped_ptr only.
friend struct base::DefaultDeleter<TempWindowMac>;
TempWindowMac();
~TempWindowMac();
scoped_ptr<TempWindowMacImpl> impl_;
DISALLOW_COPY_AND_ASSIGN(TempWindowMac);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_TEMP_WINDOW_MAC_H_