| Index: ui/ozone/ozone_platform.cc
|
| diff --git a/ui/ozone/ozone_platform.cc b/ui/ozone/ozone_platform.cc
|
| index 730be363bec8176fa8ae609cab292b08855a9fbe..7dc860595f12a3a499de8e0f82b25f35b772ac1a 100644
|
| --- a/ui/ozone/ozone_platform.cc
|
| +++ b/ui/ozone/ozone_platform.cc
|
| @@ -17,6 +17,9 @@ namespace ui {
|
|
|
| namespace {
|
|
|
| +bool g_platform_initialized_ui = false;
|
| +bool g_platform_initialized_gpu = false;
|
| +
|
| // Helper to construct an OzonePlatform by name using the platform list.
|
| OzonePlatform* CreatePlatform(const std::string& platform_name) {
|
| // Search for a matching platform in the list.
|
| @@ -43,6 +46,8 @@ std::string GetPlatformName() {
|
| OzonePlatform::OzonePlatform() {
|
| CHECK(!instance_) << "There should only be a single OzonePlatform.";
|
| instance_ = this;
|
| + g_platform_initialized_ui = false;
|
| + g_platform_initialized_gpu = false;
|
| }
|
|
|
| OzonePlatform::~OzonePlatform() {
|
| @@ -53,6 +58,9 @@ OzonePlatform::~OzonePlatform() {
|
| // static
|
| void OzonePlatform::InitializeForUI() {
|
| CreateInstance();
|
| + if (g_platform_initialized_ui)
|
| + return;
|
| + g_platform_initialized_ui = true;
|
| instance_->InitializeUI();
|
| ui::InputMethodContextFactoryOzone::SetInstance(
|
| instance_->GetInputMethodContextFactoryOzone());
|
| @@ -61,6 +69,9 @@ void OzonePlatform::InitializeForUI() {
|
| // static
|
| void OzonePlatform::InitializeForGPU() {
|
| CreateInstance();
|
| + if (g_platform_initialized_gpu)
|
| + return;
|
| + g_platform_initialized_gpu = true;
|
| instance_->InitializeGPU();
|
| }
|
|
|
|
|