Commit ea0d9421 authored by Sadrul Habib Chowdhury's avatar Sadrul Habib Chowdhury Committed by Commit Bot

aura: Root-windows should have valid FrameSinkId.

The root windows should use the FrameSinkId of the compositor. In regular
aura, compositors get valid FrameSinkId from context_factory_private().
If window server is hosting viz, then use the id from that.

BUG=754872

Change-Id: I7b1de89f9575ebd532042ffcd0b3a8058d85f251
Reviewed-on: https://chromium-review.googlesource.com/847333
Commit-Queue: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526735}
parent 33ec65c1
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host_observer.h" #include "ui/aura/window_tree_host_observer.h"
#include "ui/base/class_property.h" #include "ui/base/class_property.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/events/event.h" #include "ui/events/event.h"
...@@ -56,7 +57,11 @@ WindowTreeHostMus::WindowTreeHostMus(WindowTreeHostMusInitParams init_params) ...@@ -56,7 +57,11 @@ WindowTreeHostMus::WindowTreeHostMus(WindowTreeHostMusInitParams init_params)
// seems them at the time the window is created. // seems them at the time the window is created.
for (auto& pair : init_params.properties) for (auto& pair : init_params.properties)
window_mus->SetPropertyFromServer(pair.first, &pair.second); window_mus->SetPropertyFromServer(pair.first, &pair.second);
CreateCompositor(viz::FrameSinkId()); // If window-server is hosting viz, then use the FrameSinkId from the server.
// In other cases, let a valid FrameSinkId be selected by
// context_factory_private().
CreateCompositor(switches::IsMusHostingViz() ? window_mus->GetFrameSinkId()
: viz::FrameSinkId());
if (!init_params.uses_real_accelerated_widget) { if (!init_params.uses_real_accelerated_widget) {
gfx::AcceleratedWidget accelerated_widget; gfx::AcceleratedWidget accelerated_widget;
// We need accelerated widget numbers to be different for each window and // We need accelerated widget numbers to be different for each window and
......
...@@ -1091,6 +1091,12 @@ const viz::LocalSurfaceId& Window::GetLocalSurfaceId() const { ...@@ -1091,6 +1091,12 @@ const viz::LocalSurfaceId& Window::GetLocalSurfaceId() const {
} }
viz::FrameSinkId Window::GetFrameSinkId() const { viz::FrameSinkId Window::GetFrameSinkId() const {
if (IsRootWindow()) {
DCHECK(host_);
auto* compositor = host_->compositor();
DCHECK(compositor);
return compositor->frame_sink_id();
}
return port_->GetFrameSinkId(); return port_->GetFrameSinkId();
} }
......
...@@ -3181,6 +3181,12 @@ TEST_P(WindowTest, WindowDestroyCompletesAnimations) { ...@@ -3181,6 +3181,12 @@ TEST_P(WindowTest, WindowDestroyCompletesAnimations) {
animator->RemoveObserver(&observer); animator->RemoveObserver(&observer);
} }
TEST_P(WindowTest, RootWindowUsesCompositorFrameSinkId) {
EXPECT_EQ(host()->compositor()->frame_sink_id(),
root_window()->GetFrameSinkId());
EXPECT_TRUE(root_window()->GetFrameSinkId().is_valid());
}
TEST_P(WindowTest, LocalSurfaceIdChanges) { TEST_P(WindowTest, LocalSurfaceIdChanges) {
Window window(nullptr); Window window(nullptr);
window.Init(ui::LAYER_NOT_DRAWN); window.Init(ui::LAYER_NOT_DRAWN);
......
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