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") { ...@@ -49,6 +49,7 @@ source_set("scenic") {
"//third_party/fuchsia-sdk/sdk:images", "//third_party/fuchsia-sdk/sdk:images",
"//third_party/fuchsia-sdk/sdk:mem", "//third_party/fuchsia-sdk/sdk:mem",
"//third_party/fuchsia-sdk/sdk:scenic_cpp", "//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:sysmem",
"//third_party/fuchsia-sdk/sdk:ui_gfx", "//third_party/fuchsia-sdk/sdk:ui_gfx",
"//third_party/fuchsia-sdk/sdk:ui_scenic", "//third_party/fuchsia-sdk/sdk:ui_scenic",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import("//build/config/ui.gni") import("//build/config/ui.gni")
source_set("platform_window") { component("platform_window") {
sources = [ sources = [
"platform_window_base.cc", "platform_window_base.cc",
"platform_window_base.h", "platform_window_base.h",
...@@ -15,6 +15,8 @@ source_set("platform_window") { ...@@ -15,6 +15,8 @@ source_set("platform_window") {
"platform_window_init_properties.h", "platform_window_init_properties.h",
] ]
defines = [ "IS_PLATFORM_WINDOW_IMPL" ]
deps = [ deps = [
"//base", "//base",
"//ui/base", "//ui/base",
......
...@@ -4,7 +4,17 @@ ...@@ -4,7 +4,17 @@
import("//build/config/ui.gni") 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 = [ sources = [
"platform_window_defaults.cc", "platform_window_defaults.cc",
"platform_window_defaults.h", "platform_window_defaults.h",
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
#ifndef UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_ #ifndef UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_
#define UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_ #define UI_PLATFORM_WINDOW_COMMON_PLATFORM_WINDOW_DEFAULTS_H_
#include "base/component_export.h"
namespace ui { namespace ui {
// Returns true if PlatformWindow should use test configuration. Will return // Returns true if PlatformWindow should use test configuration. Will return
// false by default, unless test::EnableTestConfigForPlatformWindows() has been // false by default, unless test::EnableTestConfigForPlatformWindows() has been
// called, then it will return true. // called, then it will return true.
bool UseTestConfigForPlatformWindows(); COMPONENT_EXPORT(PLATFORM_WINDOW_COMMON) bool UseTestConfigForPlatformWindows();
namespace test { namespace test {
...@@ -22,6 +24,7 @@ namespace test { ...@@ -22,6 +24,7 @@ namespace test {
// various tests, otherwise the call to Show() blocks because it never receives // 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 // the MapNotify event. It is unclear why this is necessary, but might be
// related to calls to XInitThreads(). // related to calls to XInitThreads().
COMPONENT_EXPORT(PLATFORM_WINDOW_COMMON)
void EnableTestConfigForPlatformWindows(); void EnableTestConfigForPlatformWindows();
} // namespace test } // namespace test
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_FUCHSIA_INITIALIZE_PRESENTER_API_VIEW_H_ #ifndef UI_PLATFORM_WINDOW_FUCHSIA_INITIALIZE_PRESENTER_API_VIEW_H_
#define 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" #include "ui/platform_window/platform_window_init_properties.h"
namespace ui { namespace ui {
...@@ -12,6 +13,7 @@ namespace fuchsia { ...@@ -12,6 +13,7 @@ namespace fuchsia {
// Generates and sets the view tokens that are required to utilize the // Generates and sets the view tokens that are required to utilize the
// Presenter API. |window_properties_out| must be a valid value. // Presenter API. |window_properties_out| must be a valid value.
COMPONENT_EXPORT(PLATFORM_WINDOW)
void InitializeViewTokenAndPresentView( void InitializeViewTokenAndPresentView(
ui::PlatformWindowInitProperties* window_properties_out); ui::PlatformWindowInitProperties* window_properties_out);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "base/component_export.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/base/class_property.h" #include "ui/base/class_property.h"
#include "ui/base/cursor/cursor.h" #include "ui/base/cursor/cursor.h"
...@@ -28,7 +29,8 @@ namespace ui { ...@@ -28,7 +29,8 @@ namespace ui {
// //
// Each instance of PlatformWindowBase represents a single window in the // Each instance of PlatformWindowBase represents a single window in the
// underlying platform windowing system (i.e. X11/Win/OSX). // underlying platform windowing system (i.e. X11/Win/OSX).
class PlatformWindowBase : public PropertyHandler { class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowBase
: public PropertyHandler {
public: public:
PlatformWindowBase(); PlatformWindowBase();
~PlatformWindowBase() override; ~PlatformWindowBase() override;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_ #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_BASE_H_
#define 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 "base/optional.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -28,7 +29,7 @@ enum class PlatformWindowState { ...@@ -28,7 +29,7 @@ enum class PlatformWindowState {
// This is the bare minimum for PlatformWindowDeelegate, but some platforms may // This is the bare minimum for PlatformWindowDeelegate, but some platforms may
// require more, and should do so in a subclass. Please refer to // require more, and should do so in a subclass. Please refer to
// PlatformWindowDelegateLinux for an example. // PlatformWindowDelegateLinux for an example.
class PlatformWindowDelegateBase { class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateBase {
public: public:
PlatformWindowDelegateBase(); PlatformWindowDelegateBase();
virtual ~PlatformWindowDelegateBase(); virtual ~PlatformWindowDelegateBase();
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_ #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_DELEGATE_LINUX_H_
#define 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/base/buildflags.h"
#include "ui/platform_window/platform_window_delegate_base.h" #include "ui/platform_window/platform_window_delegate_base.h"
...@@ -23,7 +24,8 @@ namespace ui { ...@@ -23,7 +24,8 @@ namespace ui {
// This is an optional linux delegate interface, which should be implemented by // This is an optional linux delegate interface, which should be implemented by
// linux-based platforms. It contains both Wayland and X11 specific and common // linux-based platforms. It contains both Wayland and X11 specific and common
// interfaces. // interfaces.
class PlatformWindowDelegateLinux : public PlatformWindowDelegateBase { class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowDelegateLinux
: public PlatformWindowDelegateBase {
public: public:
PlatformWindowDelegateLinux(); PlatformWindowDelegateLinux();
~PlatformWindowDelegateLinux() override; ~PlatformWindowDelegateLinux() override;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string> #include <string>
#include "base/component_export.h"
#include "base/optional.h" #include "base/optional.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -40,7 +41,7 @@ enum class PlatformWindowOpacity { ...@@ -40,7 +41,7 @@ enum class PlatformWindowOpacity {
// Initial properties which are passed to PlatformWindow to be initialized // Initial properties which are passed to PlatformWindow to be initialized
// with a desired set of properties. // with a desired set of properties.
struct PlatformWindowInitProperties { struct COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowInitProperties {
PlatformWindowInitProperties(); PlatformWindowInitProperties();
// Initializes properties with the specified |bounds|. // Initializes properties with the specified |bounds|.
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_ #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_LINUX_H_
#define 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 "base/optional.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/platform_window/platform_window_base.h" #include "ui/platform_window/platform_window_base.h"
...@@ -12,7 +13,8 @@ ...@@ -12,7 +13,8 @@
namespace ui { namespace ui {
// Linux extensions to the PlatformWindowBase. // Linux extensions to the PlatformWindowBase.
class PlatformWindowLinux : public PlatformWindowBase { class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowLinux
: public PlatformWindowBase {
public: public:
PlatformWindowLinux(); PlatformWindowLinux();
~PlatformWindowLinux() override; ~PlatformWindowLinux() override;
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
#ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_ #ifndef UI_PLATFORM_WINDOW_PLATFORM_WINDOW_WIN_H_
#define 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" #include "ui/platform_window/platform_window_base.h"
namespace ui { namespace ui {
// Windows extensions to the PlatformWindowBase. // Windows extensions to the PlatformWindowBase.
class PlatformWindowWin : public PlatformWindowBase { class COMPONENT_EXPORT(PLATFORM_WINDOW) PlatformWindowWin
: public PlatformWindowBase {
public: public:
PlatformWindowWin() = default; PlatformWindowWin() = default;
~PlatformWindowWin() override = 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