Commit 6ae6cf7e authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

mus/aura: Wait for the real AcceleratedWidget.

When mus does not host viz, aura handles the real AcceleratedWidget. So
in such cases, WindowTreeHostMus needs to wait for the widget to be
avaiable, which is still created by mus and sent to aura over mojom.

BUG=786453, 791619

Change-Id: I335365bfe4793c8fafb8d08eaa45c09c50e17a59
Reviewed-on: https://chromium-review.googlesource.com/807887Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521903}
parent 4cd6bc10
......@@ -39,6 +39,7 @@
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/mus/window_tree_host_mus_init_params.h"
#include "ui/aura/window.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/display/manager/display_manager.h"
#include "ui/display/manager/forwarding_display_delegate.h"
#include "ui/display/types/native_display_delegate.h"
......@@ -205,6 +206,8 @@ std::unique_ptr<AshWindowTreeHost> ShellPortMus::CreateAshWindowTreeHost(
aura_init_params.display_id = init_params.display_id;
aura_init_params.display_init_params = std::move(display_params);
aura_init_params.use_classic_ime = !Shell::ShouldUseIMEService();
aura_init_params.uses_real_accelerated_widget =
!::switches::IsMusHostingViz();
return std::make_unique<AshWindowTreeHostMus>(std::move(aura_init_params));
}
......
......@@ -591,6 +591,8 @@ std::unique_ptr<WindowTreeHostMus> WindowTreeClient::CreateWindowTreeHost(
init_params.window_port = std::move(window_port);
init_params.window_tree_client = this;
init_params.display_id = display_id;
if (window_manager_delegate_ && window_mus_type == WindowMusType::EMBED)
init_params.uses_real_accelerated_widget = !::switches::IsMusHostingViz();
std::unique_ptr<WindowTreeHostMus> window_tree_host =
std::make_unique<WindowTreeHostMus>(std::move(init_params));
window_tree_host->InitHost();
......
......@@ -56,19 +56,20 @@ WindowTreeHostMus::WindowTreeHostMus(WindowTreeHostMusInitParams init_params)
for (auto& pair : init_params.properties)
window_mus->SetPropertyFromServer(pair.first, &pair.second);
CreateCompositor(viz::FrameSinkId());
gfx::AcceleratedWidget accelerated_widget;
// We need accelerated widget numbers to be different for each
// window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
// has this property.
if (!init_params.uses_real_accelerated_widget) {
gfx::AcceleratedWidget accelerated_widget;
// We need accelerated widget numbers to be different for each window and
// fit in the smallest sizeof(AcceleratedWidget) uint32_t has this property.
#if defined(OS_WIN) || defined(OS_ANDROID)
accelerated_widget =
reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
accelerated_widget =
reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
#else
accelerated_widget =
static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
accelerated_widget =
static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
#endif
OnAcceleratedWidgetAvailable(accelerated_widget,
GetDisplay().device_scale_factor());
OnAcceleratedWidgetAvailable(accelerated_widget,
GetDisplay().device_scale_factor());
}
delegate_->OnWindowTreeHostCreated(this);
......
......@@ -74,6 +74,12 @@ struct AURA_EXPORT WindowTreeHostMusInitParams {
// Use classic IME (i.e. InputMethodChromeOS) instead of servicified IME
// (i.e. InputMethodMus).
bool use_classic_ime = false;
// Whether this client hosts a real gfx::AcceleratedWidget or not. This is set
// to true only when mus is not hosting viz, and instead expects the client
// to host viz (which is why the client would get the real
// gfx::AcceleratedWidget).
bool uses_real_accelerated_widget = false;
};
// Creates a WindowTreeHostMusInitParams that is used when creating a top-level
......
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