Commit 7c5fae02 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Remove OzonePlatform::EnsureInstance()

Everywhere we access OzonePlatform, it is already initialized (and
should be in future). There is no need for EnsureInstance() anymore.

BUG=958387

Change-Id: I1adf0f65ce8a446275417856caeb56c2310bea2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1763633Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Reviewed-by: default avatarDaniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704838}
parent 172b8312
......@@ -110,8 +110,8 @@ bool GpuMemoryBufferSupport::IsNativeGpuMemoryBufferConfigurationSupported(
NOTREACHED();
return false;
#elif defined(USE_OZONE)
return ui::OzonePlatform::EnsureInstance()->IsNativePixmapConfigSupported(
format, usage);
return ui::OzonePlatform::GetInstance()->IsNativePixmapConfigSupported(format,
usage);
#elif defined(OS_LINUX)
return false; // TODO(julian.isorce): Add linux support.
#elif defined(OS_WIN)
......
......@@ -18,7 +18,23 @@
namespace ui {
namespace {
OzonePlatform* g_instance = nullptr;
void EnsureInstance() {
if (g_instance)
return;
TRACE_EVENT1("ozone", "OzonePlatform::Initialize", "platform",
GetOzonePlatformName());
std::unique_ptr<OzonePlatform> platform =
PlatformObject<OzonePlatform>::Create();
// TODO(spang): Currently need to leak this object.
OzonePlatform* pl = platform.release();
DCHECK_EQ(g_instance, pl);
}
} // namespace
OzonePlatform::OzonePlatform() {
......@@ -62,23 +78,6 @@ const char* OzonePlatform::GetPlatformName() {
return GetOzonePlatformName();
}
// static
OzonePlatform* OzonePlatform::EnsureInstance() {
if (!g_instance) {
TRACE_EVENT1("ozone",
"OzonePlatform::Initialize",
"platform",
GetOzonePlatformName());
std::unique_ptr<OzonePlatform> platform =
PlatformObject<OzonePlatform>::Create();
// TODO(spang): Currently need to leak this object.
OzonePlatform* pl = platform.release();
DCHECK_EQ(g_instance, pl);
}
return g_instance;
}
IPC::MessageFilter* OzonePlatform::GetGpuMessageFilter() {
return nullptr;
}
......
......@@ -120,12 +120,6 @@ class COMPONENT_EXPORT(OZONE) OzonePlatform {
bool supports_overlays = false;
};
// Ensures that the OzonePlatform instance exists, without doing any
// initialization. No-op in case the instance is already created. This is
// useful in order to call virtual methods that depend on the Ozone platform
// selected at runtime, e.g. IsNativePixmapConfigSupported().
static OzonePlatform* EnsureInstance();
// Initializes the subsystems/resources necessary for the UI process (e.g.
// events) with additional properties to customize the ozone platform
// implementation. Ozone will not retain InitParams after returning from
......
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