Commit fbf0a8b0 authored by Michael Spang's avatar Michael Spang Committed by Commit Bot

platform_window: Fix component builds (reland)

The platform_window target is used from multiple components and should
therefore be a component itself. This is needed to avoid ODR violations.

One ODR problem that currently can happen is the duplication of the
global boolean backing UseTestConfigForPlatformWindows().

Reland with fuchsia_dbg fixes.

Bug: 1019015

Change-Id: I6781667889b45ce178d5a5aaa95807d6b0eb94e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1891457Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Michael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711059}
parent 7e4d204c
......@@ -49,6 +49,7 @@ source_set("scenic") {
"//third_party/fuchsia-sdk/sdk:images",
"//third_party/fuchsia-sdk/sdk:mem",
"//third_party/fuchsia-sdk/sdk:scenic_cpp",
"//third_party/fuchsia-sdk/sdk:sys_cpp",
"//third_party/fuchsia-sdk/sdk:sysmem",
"//third_party/fuchsia-sdk/sdk:ui_gfx",
"//third_party/fuchsia-sdk/sdk:ui_scenic",
......
......@@ -4,7 +4,7 @@
import("//build/config/ui.gni")
source_set("platform_window") {
component("platform_window") {
sources = [
"platform_window_base.cc",
"platform_window_base.h",
......@@ -15,6 +15,8 @@ source_set("platform_window") {
"platform_window_init_properties.h",
]
defines = [ "IS_PLATFORM_WINDOW_IMPL" ]
deps = [
"//base",
"//ui/base",
......
......@@ -4,7 +4,17 @@
import("//build/config/ui.gni")
source_set("common") {
assert(is_linux)
component("common") {
output_name = "platform_window_common"
defines = [ "IS_PLATFORM_WINDOW_COMMON_IMPL" ]
public_deps = [
"//base",
]
sources = [
"platform_window_defaults.cc",
"platform_window_defaults.h",
......
......@@ -5,12 +5,14 @@
#ifndef UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_
#define UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_
#include "base/component_export.h"
namespace ui {
// Returns true if PlatformWindow should use test configuration. Will return
// false by default, unless test::EnableTestConfigForPlatformWindows() has been
// called, then it will return true.
bool UseTestConfigForPlatformWindows();
COMPONENT_EXPORT(PLATFORM_WINDOW_COMMON) bool UseTestConfigForPlatformWindows();
namespace test {
......@@ -22,6 +24,7 @@ namespace test {
// various tests, otherwise the call to Show() blocks because it never receives
// the MapNotify event. It is unclear why this is necessary, but might be
// related to calls to XInitThreads().
COMPONENT_EXPORT(PLATFORM_WINDOW_COMMON)
void EnableTestConfigForPlatformWindows();
} // namespace test
......
......@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_FUCHSIA_INITIALIZE_PRESENTER_API_VIEW_H_
#define UI_PLATFORM_WINDOW_FUCHSIA_INITIALIZE_PRESENTER_API_VIEW_H_
#include "base/component_export.h"
#include "ui/platform_window/platform_window_init_properties.h"
namespace ui {
......@@ -12,6 +13,7 @@ namespace fuchsia {
// Generates and sets the view tokens that are required to utilize the
// Presenter API. |window_properties_out| must be a valid value.
COMPONENT_EXPORT(PLATFORM_WINDOW)
void InitializeViewTokenAndPresentView(
ui::PlatformWindowInitProperties* window_properties_out);
......
......@@ -7,6 +7,7 @@
#include <memory>
#include "base/component_export.h"
#include "base/strings/string16.h"
#include "ui/base/class_property.h"
#include "ui/base/cursor/cursor.h"
......@@ -28,7 +29,8 @@ namespace ui {
//
// Each instance of PlatformWindowBase represents a single window in the
// underlying platform windowing system (i.e. X11/Win/OSX).
class PlatformWindowBase : public PropertyHandler {
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowBase
: public PropertyHandler {
public:
PlatformWindowBase();
~PlatformWindowBase() override;
......
......@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_
#include "base/component_export.h"
#include "base/optional.h"
#include "ui/gfx/native_widget_types.h"
......@@ -28,7 +29,7 @@ enum class PlatformWindowState {
// This is the bare minimum for PlatformWindowDeelegate, but some platforms may
// require more, and should do so in a subclass. Please refer to
// PlatformWindowDelegateLinux for an example.
class PlatformWindowDelegateBase {
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateBase {
public:
PlatformWindowDelegateBase();
virtual ~PlatformWindowDelegateBase();
......
......@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_
#include "base/component_export.h"
#include "ui/base/buildflags.h"
#include "ui/platform_window/platform_window_delegate_base.h"
......@@ -23,7 +24,8 @@ namespace ui {
// This is an optional linux delegate interface, which should be implemented by
// linux-based platforms. It contains both Wayland and X11 specific and common
// interfaces.
class PlatformWindowDelegateLinux : public PlatformWindowDelegateBase {
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateLinux
: public PlatformWindowDelegateBase {
public:
PlatformWindowDelegateLinux();
~PlatformWindowDelegateLinux() override;
......
......@@ -7,6 +7,7 @@
#include <string>
#include "base/component_export.h"
#include "base/optional.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/rect.h"
......@@ -40,7 +41,7 @@ enum class PlatformWindowOpacity {
// Initial properties which are passed to PlatformWindow to be initialized
// with a desired set of properties.
struct PlatformWindowInitProperties {
struct COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowInitProperties {
PlatformWindowInitProperties();
// Initializes properties with the specified |bounds|.
......
......@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_
#include "base/component_export.h"
#include "base/optional.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/platform_window/platform_window_base.h"
......@@ -12,7 +13,8 @@
namespace ui {
// Linux extensions to the PlatformWindowBase.
class PlatformWindowLinux : public PlatformWindowBase {
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowLinux
: public PlatformWindowBase {
public:
PlatformWindowLinux();
~PlatformWindowLinux() override;
......
......@@ -5,12 +5,14 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_
#define UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_
#include "base/component_export.h"
#include "ui/platform_window/platform_window_base.h"
namespace ui {
// Windows extensions to the PlatformWindowBase.
class PlatformWindowWin : public PlatformWindowBase {
class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowWin
: public PlatformWindowBase {
public:
PlatformWindowWin() = default;
~PlatformWindowWin() override = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment