Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: ui/aura/mus/window_port_mus.cc

Issue 2875753002: Implement aura::WindowPortMus::CreateCompositorFrameSink() (Closed)
Patch Set: Address review issues Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/mus/window_port_mus.h" 5 #include "ui/aura/mus/window_port_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/transient_window_client.h" 9 #include "ui/aura/client/transient_window_client.h"
10 #include "ui/aura/mus/client_surface_embedder.h" 10 #include "ui/aura/mus/client_surface_embedder.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 window_tree_client_->SetCanAcceptDrops(this, can_accept_drops); 86 window_tree_client_->SetCanAcceptDrops(this, can_accept_drops);
87 } 87 }
88 88
89 void WindowPortMus::Embed( 89 void WindowPortMus::Embed(
90 ui::mojom::WindowTreeClientPtr client, 90 ui::mojom::WindowTreeClientPtr client,
91 uint32_t flags, 91 uint32_t flags,
92 const ui::mojom::WindowTree::EmbedCallback& callback) { 92 const ui::mojom::WindowTree::EmbedCallback& callback) {
93 window_tree_client_->Embed(window_, std::move(client), flags, callback); 93 window_tree_client_->Embed(window_, std::move(client), flags, callback);
94 } 94 }
95 95
96 std::unique_ptr<cc::CompositorFrameSink>
97 WindowPortMus::RequestCompositorFrameSink(
98 scoped_refptr<cc::ContextProvider> context_provider,
99 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
100 std::unique_ptr<ui::ClientCompositorFrameSinkBinding>
101 compositor_frame_sink_binding;
102 std::unique_ptr<ui::ClientCompositorFrameSink> compositor_frame_sink =
103 ui::ClientCompositorFrameSink::Create(
104 std::move(context_provider), gpu_memory_buffer_manager,
105 &compositor_frame_sink_binding,
106 window_tree_client_->enable_surface_synchronization_);
107 AttachCompositorFrameSink(std::move(compositor_frame_sink_binding));
108 return std::move(compositor_frame_sink);
109 }
110
111 void WindowPortMus::AttachCompositorFrameSink( 96 void WindowPortMus::AttachCompositorFrameSink(
112 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> 97 std::unique_ptr<ui::ClientCompositorFrameSinkBinding>
113 compositor_frame_sink_binding) { 98 compositor_frame_sink_binding) {
114 window_tree_client_->AttachCompositorFrameSink( 99 window_tree_client_->AttachCompositorFrameSink(
115 server_id(), compositor_frame_sink_binding->TakeFrameSinkRequest(), 100 server_id(), compositor_frame_sink_binding->TakeFrameSinkRequest(),
116 mojo::MakeProxy(compositor_frame_sink_binding->TakeFrameSinkClient())); 101 mojo::MakeProxy(compositor_frame_sink_binding->TakeFrameSinkClient()));
117 } 102 }
118 103
119 WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange( 104 WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange(
120 const ServerChangeType type, 105 const ServerChangeType type,
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 GetPropertyConverter()->GetTransportNameForPropertyKey(key); 473 GetPropertyConverter()->GetTransportNameForPropertyKey(key);
489 // TODO(sky): investigate to see if we need to compare data. In particular do 474 // TODO(sky): investigate to see if we need to compare data. In particular do
490 // we ever have a case where changing a property cascades into changing the 475 // we ever have a case where changing a property cascades into changing the
491 // same property? 476 // same property?
492 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) 477 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data))
493 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, 478 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value,
494 std::move(data)); 479 std::move(data));
495 } 480 }
496 481
497 std::unique_ptr<cc::CompositorFrameSink> 482 std::unique_ptr<cc::CompositorFrameSink>
498 WindowPortMus::CreateCompositorFrameSink() { 483 WindowPortMus::CreateCompositorFrameSink(
499 // TODO(penghuang): Implement it for Mus. 484 scoped_refptr<cc::ContextProvider> context_provider,
500 return nullptr; 485 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
486 DCHECK_NE(window_mus_type(), WindowMusType::EMBED_IN_OWNER);
487 DCHECK_NE(window_mus_type(), WindowMusType::TOP_LEVEL_IN_WM);
488 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> frame_sink_binding;
489 std::unique_ptr<ui::ClientCompositorFrameSink> frame_sink =
490 ui::ClientCompositorFrameSink::Create(
491 std::move(context_provider), gpu_memory_buffer_manager,
492 &frame_sink_binding,
493 window_tree_client_->enable_surface_synchronization_);
494 AttachCompositorFrameSink(std::move(frame_sink_binding));
495 return std::move(frame_sink);
501 } 496 }
502 497
503 cc::SurfaceId WindowPortMus::GetSurfaceId() const { 498 cc::SurfaceId WindowPortMus::GetSurfaceId() const {
504 // TODO(penghuang): Implement it for Mus. 499 // This method is only used by exo unittests which are not running against
500 // mus, so don't implement it now.
505 return cc::SurfaceId(); 501 return cc::SurfaceId();
506 } 502 }
507 503
508 void WindowPortMus::UpdatePrimarySurfaceInfo() { 504 void WindowPortMus::UpdatePrimarySurfaceInfo() {
509 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || 505 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
510 window_mus_type() == WindowMusType::EMBED_IN_OWNER; 506 window_mus_type() == WindowMusType::EMBED_IN_OWNER;
511 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_) 507 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_)
512 return; 508 return;
513 509
514 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) 510 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid())
515 return; 511 return;
516 512
517 SetPrimarySurfaceInfo( 513 SetPrimarySurfaceInfo(
518 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), 514 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_),
519 ScaleFactorForDisplay(window_), last_surface_size_)); 515 ScaleFactorForDisplay(window_), last_surface_size_));
520 } 516 }
521 517
522 void WindowPortMus::UpdateClientSurfaceEmbedder() { 518 void WindowPortMus::UpdateClientSurfaceEmbedder() {
523 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
524 window_mus_type() == WindowMusType::EMBED_IN_OWNER;
525 if (!embeds_surface)
526 return;
527
528 if (!client_surface_embedder_) { 519 if (!client_surface_embedder_) {
529 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( 520 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>(
530 window_, window_tree_client_->normal_client_area_insets_); 521 window_, window_tree_client_->normal_client_area_insets_);
531 } 522 }
532 523
533 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); 524 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_);
534 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); 525 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_);
535 } 526 }
536 527
537 } // namespace aura 528 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698