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 03acb08f04c2d3fea7c7cfef540c0e239ae5a5a4..f47ba8a4d07ea25f1a776da97c3c339e06d71e8a 100644 |
--- a/ui/aura/mus/window_port_mus.cc |
+++ b/ui/aura/mus/window_port_mus.cc |
@@ -8,7 +8,6 @@ |
#include "components/viz/client/local_surface_id_provider.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/client/transient_window_client.h" |
-#include "ui/aura/env.h" |
#include "ui/aura/mus/client_surface_embedder.h" |
#include "ui/aura/mus/property_converter.h" |
#include "ui/aura/mus/window_tree_client.h" |
@@ -96,7 +95,7 @@ |
window_tree_client_->Embed(window_, std::move(client), flags, callback); |
} |
-std::unique_ptr<viz::ClientCompositorFrameSink> |
+std::unique_ptr<cc::CompositorFrameSink> |
WindowPortMus::RequestCompositorFrameSink( |
scoped_refptr<cc::ContextProvider> context_provider, |
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) { |
@@ -116,7 +115,7 @@ |
enable_surface_synchronization); |
window_tree_client_->AttachCompositorFrameSink( |
server_id(), std::move(sink_request), std::move(client)); |
- return compositor_frame_sink; |
+ return std::move(compositor_frame_sink); |
} |
WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange( |
@@ -307,25 +306,18 @@ |
if (frame_sink_id_.is_valid()) |
UpdatePrimarySurfaceInfo(); |
- if (local_compositor_frame_sink_) |
- local_compositor_frame_sink_->SetLocalSurfaceId(local_surface_id_); |
- |
return local_surface_id_; |
+} |
+ |
+void WindowPortMus::SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info) { |
+ primary_surface_info_ = surface_info; |
+ UpdateClientSurfaceEmbedder(); |
+ if (window_->delegate()) |
+ window_->delegate()->OnWindowSurfaceChanged(surface_info); |
} |
void WindowPortMus::SetFallbackSurfaceInfo( |
const cc::SurfaceInfo& surface_info) { |
- if (!frame_sink_id_.is_valid()) { |
- // |primary_surface_info_| shold not be valid, since we didn't know the |
- // |frame_sink_id_|. |
- DCHECK(!primary_surface_info_.is_valid()); |
- frame_sink_id_ = surface_info.id().frame_sink_id(); |
- UpdatePrimarySurfaceInfo(); |
- } |
- |
- // The frame sink id should never be changed. |
- DCHECK_EQ(surface_info.id().frame_sink_id(), frame_sink_id_); |
- |
fallback_surface_info_ = surface_info; |
UpdateClientSurfaceEmbedder(); |
} |
@@ -434,10 +426,6 @@ |
observer.OnEmbeddedAppDisconnected(window_); |
} |
-bool WindowPortMus::HasLocalCompositorFrameSink() { |
- return !!local_compositor_frame_sink_; |
-} |
- |
void WindowPortMus::OnPreInit(Window* window) { |
window_ = window; |
window_tree_client_->OnWindowMusCreated(this); |
@@ -533,46 +521,38 @@ |
std::unique_ptr<cc::CompositorFrameSink> |
WindowPortMus::CreateCompositorFrameSink() { |
- DCHECK_EQ(window_mus_type(), WindowMusType::LOCAL); |
- DCHECK(!local_compositor_frame_sink_); |
- auto frame_sink = RequestCompositorFrameSink( |
- nullptr, |
- aura::Env::GetInstance()->context_factory()->GetGpuMemoryBufferManager()); |
- local_compositor_frame_sink_ = frame_sink->GetWeakPtr(); |
- return frame_sink; |
+ // TODO(penghuang): Implement it for Mus. |
+ return nullptr; |
} |
cc::SurfaceId WindowPortMus::GetSurfaceId() const { |
- // This is only used by WindowPortLocal in unit tests. |
+ // TODO(penghuang): Implement it for Mus. |
return cc::SurfaceId(); |
} |
void WindowPortMus::UpdatePrimarySurfaceInfo() { |
- if (window_mus_type() != WindowMusType::TOP_LEVEL_IN_WM && |
- window_mus_type() != WindowMusType::EMBED_IN_OWNER && |
- window_mus_type() != WindowMusType::DISPLAY_MANUALLY_CREATED && |
- window_mus_type() != WindowMusType::LOCAL) { |
+ bool embeds_surface = |
+ window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
+ window_mus_type() == WindowMusType::EMBED_IN_OWNER || |
+ window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED; |
+ if (!embeds_surface) |
return; |
- } |
if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) |
return; |
- primary_surface_info_ = cc::SurfaceInfo( |
+ SetPrimarySurfaceInfo(cc::SurfaceInfo( |
cc::SurfaceId(frame_sink_id_, local_surface_id_), |
- ScaleFactorForDisplay(window_), last_surface_size_in_pixels_); |
- UpdateClientSurfaceEmbedder(); |
- if (window_->delegate()) |
- window_->delegate()->OnWindowSurfaceChanged(primary_surface_info_); |
+ ScaleFactorForDisplay(window_), last_surface_size_in_pixels_)); |
} |
void WindowPortMus::UpdateClientSurfaceEmbedder() { |
- if (window_mus_type() != WindowMusType::TOP_LEVEL_IN_WM && |
- window_mus_type() != WindowMusType::EMBED_IN_OWNER && |
- window_mus_type() != WindowMusType::DISPLAY_MANUALLY_CREATED && |
- window_mus_type() != WindowMusType::LOCAL) { |
+ bool embeds_surface = |
+ window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
+ window_mus_type() == WindowMusType::EMBED_IN_OWNER || |
+ window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED; |
+ if (!embeds_surface) |
return; |
- } |
if (!client_surface_embedder_) { |
client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( |