| Index: ui/aura/mus/window_port_mus.cc
|
| diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc
|
| index 8fdf62b0de3c66c053ea0ab8b80a653273b4e9fd..61b7105e4d8900a96bc7f80e8ad473be5230815f 100644
|
| --- a/ui/aura/mus/window_port_mus.cc
|
| +++ b/ui/aura/mus/window_port_mus.cc
|
| @@ -83,7 +83,16 @@ WindowPortMus::RequestCompositorFrameSink(
|
| ui::WindowCompositorFrameSink::Create(
|
| cc::FrameSinkId(server_id(), 0), std::move(context_provider),
|
| gpu_memory_buffer_manager, &compositor_frame_sink_binding);
|
| + compositor_frame_sink_ = compositor_frame_sink->GetWeakPtr();
|
| AttachCompositorFrameSink(std::move(compositor_frame_sink_binding));
|
| + fprintf(stderr,
|
| + ">>>WindowPortMus::RequestCompositorFrameSink frame_sink_id: %s "
|
| + "local_frame_id: %s\n",
|
| + cc::FrameSinkId(server_id(), 0).ToString().c_str(),
|
| + current_local_frame_id_.ToString().c_str());
|
| + if (current_local_frame_id_.is_valid()) {
|
| + compositor_frame_sink_->SetLocalFrameId(current_local_frame_id_);
|
| + }
|
| return compositor_frame_sink;
|
| }
|
|
|
| @@ -171,6 +180,14 @@ Window* WindowPortMus::GetWindow() {
|
| return window_;
|
| }
|
|
|
| +void WindowPortMus::SetLayerType(ui::LayerType layer_type) {
|
| + layer_type_ = layer_type;
|
| +}
|
| +
|
| +ui::LayerType WindowPortMus::GetLayerType() const {
|
| + return layer_type_;
|
| +}
|
| +
|
| void WindowPortMus::AddChildFromServer(WindowMus* window) {
|
| ServerChangeData data;
|
| data.child_id = window->server_id();
|
| @@ -201,11 +218,18 @@ void WindowPortMus::ReorderFromServer(WindowMus* child,
|
| window_->StackChildAbove(child->GetWindow(), relative->GetWindow());
|
| }
|
|
|
| -void WindowPortMus::SetBoundsFromServer(const gfx::Rect& bounds) {
|
| +void WindowPortMus::SetBoundsFromServer(
|
| + const gfx::Rect& bounds,
|
| + const cc::LocalFrameId& local_frame_id) {
|
| ServerChangeData data;
|
| data.bounds_in_dip = bounds;
|
| ScopedServerChange change(this, ServerChangeType::BOUNDS, data);
|
| window_->SetBounds(bounds);
|
| + current_local_frame_id_ = local_frame_id;
|
| + fprintf(stderr, ">>>%s %s\n", __PRETTY_FUNCTION__,
|
| + local_frame_id.ToString().c_str());
|
| + if (compositor_frame_sink_)
|
| + compositor_frame_sink_->SetLocalFrameId(local_frame_id);
|
| }
|
|
|
| void WindowPortMus::SetVisibleFromServer(bool visible) {
|
| @@ -256,7 +280,7 @@ void WindowPortMus::SetSurfaceInfoFromServer(
|
| if (!client_surface_embedder && surface_info.id().is_valid())
|
| client_surface_embedder = base::MakeUnique<ClientSurfaceEmbedder>(window_);
|
|
|
| - if (surface_info.id().is_valid())
|
| + if (surface_info.id().is_valid() && window_->IsVisible())
|
| client_surface_embedder->UpdateSurface(surface_info);
|
| else
|
| client_surface_embedder.reset();
|
| @@ -264,6 +288,20 @@ void WindowPortMus::SetSurfaceInfoFromServer(
|
| surface_info_ = surface_info;
|
| }
|
|
|
| +void WindowPortMus::SetLocalFrameIdFromServer(
|
| + const cc::LocalFrameId& local_frame_id) {
|
| + if (window_->bounds().size().IsEmpty())
|
| + return;
|
| +
|
| + cc::SurfaceInfo surface_info(
|
| + cc::SurfaceId(cc::FrameSinkId(server_id(), 0), local_frame_id), 1.0f,
|
| + window_->bounds().size());
|
| +
|
| + fprintf(stderr, ">>>>%s %s\n", __PRETTY_FUNCTION__,
|
| + local_frame_id.ToString().c_str());
|
| + SetSurfaceInfoFromServer(surface_info);
|
| +}
|
| +
|
| void WindowPortMus::DestroyFromServer() {
|
| std::unique_ptr<ScopedServerChange> remove_from_parent_change;
|
| if (window_->parent()) {
|
| @@ -364,9 +402,11 @@ void WindowPortMus::NotifyEmbeddedAppDisconnected() {
|
| observer.OnEmbeddedAppDisconnected(window_);
|
| }
|
|
|
| -void WindowPortMus::OnPreInit(Window* window) {
|
| +void WindowPortMus::OnPreInit(Window* window, ui::LayerType layer_type) {
|
| window_ = window;
|
| - window_tree_client_->OnWindowMusCreated(this);
|
| + window_tree_client_->OnWindowMusCreated(this, layer_type);
|
| + fprintf(stderr, ">>>%s layer_type: %d\n", __PRETTY_FUNCTION__,
|
| + (uint32_t)layer_type);
|
| }
|
|
|
| void WindowPortMus::OnDeviceScaleFactorChanged(float device_scale_factor) {
|
| @@ -405,6 +445,9 @@ void WindowPortMus::OnVisibilityChanged(bool visible) {
|
| change_data.visible = visible;
|
| if (!RemoveChangeByTypeAndData(ServerChangeType::VISIBLE, change_data))
|
| window_tree_client_->OnWindowMusSetVisible(this, visible);
|
| + // Update the ClientSurfaceEmbedder on visibility change.
|
| + if (surface_info_.id().is_valid())
|
| + SetSurfaceInfoFromServer(surface_info_);
|
| }
|
|
|
| void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds,
|
|
|