| Index: content/renderer/mus/renderer_window_tree_client.cc
|
| diff --git a/content/renderer/mus/renderer_window_tree_client.cc b/content/renderer/mus/renderer_window_tree_client.cc
|
| index 44474e0fc9c520c6a5df92555d99dd63c40c1b44..6940056d099c683b4b6484a9bfaa15012dffb471 100644
|
| --- a/content/renderer/mus/renderer_window_tree_client.cc
|
| +++ b/content/renderer/mus/renderer_window_tree_client.cc
|
| @@ -41,6 +41,27 @@ void RendererWindowTreeClient::Destroy(int routing_id) {
|
| client->DestroySelf();
|
| }
|
|
|
| +void RendererWindowTreeClient::Bind(
|
| + ui::mojom::WindowTreeClientRequest request) {
|
| + binding_.Bind(std::move(request));
|
| +}
|
| +
|
| +void RendererWindowTreeClient::RequestCompositorFrameSink(
|
| + scoped_refptr<cc::ContextProvider> context_provider,
|
| + gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
|
| + const CompositorFrameSinkCallback& callback) {
|
| + DCHECK(pending_compositor_frame_sink_callback_.is_null());
|
| + if (frame_sink_id_.is_valid()) {
|
| + RequestCompositorFrameSinkInternal(std::move(context_provider),
|
| + gpu_memory_buffer_manager, callback);
|
| + return;
|
| + }
|
| +
|
| + pending_context_provider_ = std::move(context_provider);
|
| + pending_gpu_memory_buffer_manager_ = gpu_memory_buffer_manager;
|
| + pending_compositor_frame_sink_callback_ = callback;
|
| +}
|
| +
|
| RendererWindowTreeClient::RendererWindowTreeClient(int routing_id)
|
| : routing_id_(routing_id), binding_(this) {}
|
|
|
| @@ -48,28 +69,18 @@ RendererWindowTreeClient::~RendererWindowTreeClient() {
|
| g_connections.Get().erase(routing_id_);
|
| }
|
|
|
| -void RendererWindowTreeClient::Bind(
|
| - ui::mojom::WindowTreeClientRequest request) {
|
| - binding_.Bind(std::move(request));
|
| -}
|
| -
|
| -std::unique_ptr<cc::CompositorFrameSink>
|
| -RendererWindowTreeClient::CreateCompositorFrameSink(
|
| - const cc::FrameSinkId& frame_sink_id,
|
| +void RendererWindowTreeClient::RequestCompositorFrameSinkInternal(
|
| scoped_refptr<cc::ContextProvider> context_provider,
|
| - gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
|
| + gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
|
| + const CompositorFrameSinkCallback& callback) {
|
| std::unique_ptr<ui::ClientCompositorFrameSinkBinding> frame_sink_binding;
|
| auto frame_sink = ui::ClientCompositorFrameSink::Create(
|
| - frame_sink_id, std::move(context_provider), gpu_memory_buffer_manager,
|
| + frame_sink_id_, std::move(context_provider), gpu_memory_buffer_manager,
|
| &frame_sink_binding);
|
| - if (tree_) {
|
| - tree_->AttachCompositorFrameSink(
|
| - root_window_id_, frame_sink_binding->TakeFrameSinkRequest(),
|
| - mojo::MakeProxy(frame_sink_binding->TakeFrameSinkClient()));
|
| - } else {
|
| - pending_frame_sink_ = std::move(frame_sink_binding);
|
| - }
|
| - return std::move(frame_sink);
|
| + tree_->AttachCompositorFrameSink(
|
| + root_window_id_, frame_sink_binding->TakeFrameSinkRequest(),
|
| + mojo::MakeProxy(frame_sink_binding->TakeFrameSinkClient()));
|
| + callback.Run(std::move(frame_sink));
|
| }
|
|
|
| void RendererWindowTreeClient::DestroySelf() {
|
| @@ -81,14 +92,18 @@ void RendererWindowTreeClient::OnEmbed(ui::ClientSpecificId client_id,
|
| ui::mojom::WindowTreePtr tree,
|
| int64_t display_id,
|
| ui::Id focused_window_id,
|
| - bool drawn) {
|
| + bool drawn,
|
| + const cc::FrameSinkId& frame_sink_id) {
|
| + frame_sink_id_ = frame_sink_id;
|
| root_window_id_ = root->window_id;
|
| tree_ = std::move(tree);
|
| - if (pending_frame_sink_) {
|
| - tree_->AttachCompositorFrameSink(
|
| - root_window_id_, pending_frame_sink_->TakeFrameSinkRequest(),
|
| - mojo::MakeProxy(pending_frame_sink_->TakeFrameSinkClient()));
|
| - pending_frame_sink_ = nullptr;
|
| + if (!pending_compositor_frame_sink_callback_.is_null()) {
|
| + RequestCompositorFrameSinkInternal(std::move(pending_context_provider_),
|
| + pending_gpu_memory_buffer_manager_,
|
| + pending_compositor_frame_sink_callback_);
|
| + pending_context_provider_ = nullptr;
|
| + pending_gpu_memory_buffer_manager_ = nullptr;
|
| + pending_compositor_frame_sink_callback_.Reset();
|
| }
|
| }
|
|
|
| @@ -104,10 +119,12 @@ void RendererWindowTreeClient::OnUnembed(ui::Id window_id) {
|
| void RendererWindowTreeClient::OnCaptureChanged(ui::Id new_capture_window_id,
|
| ui::Id old_capture_window_id) {}
|
|
|
| -void RendererWindowTreeClient::OnTopLevelCreated(uint32_t change_id,
|
| - ui::mojom::WindowDataPtr data,
|
| - int64_t display_id,
|
| - bool drawn) {
|
| +void RendererWindowTreeClient::OnTopLevelCreated(
|
| + uint32_t change_id,
|
| + ui::mojom::WindowDataPtr data,
|
| + int64_t display_id,
|
| + bool drawn,
|
| + const cc::FrameSinkId& frame_sink_id) {
|
| NOTREACHED();
|
| }
|
|
|
|
|