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

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

Issue 2875753002: Implement aura::WindowPortMus::CreateCompositorFrameSink() (Closed)
Patch Set: Fix unittests Created 3 years, 6 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 cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info;
101 cc::mojom::MojoCompositorFrameSinkRequest sink_request =
102 mojo::MakeRequest(&sink_info);
103 cc::mojom::MojoCompositorFrameSinkClientPtr client;
104 cc::mojom::MojoCompositorFrameSinkClientRequest client_request =
105 mojo::MakeRequest(&client);
106 auto compositor_frame_sink = base::MakeUnique<viz::ClientCompositorFrameSink>(
107 std::move(context_provider), gpu_memory_buffer_manager,
108 std::move(sink_info), std::move(client_request),
109 window_tree_client_->enable_surface_synchronization_);
110 window_tree_client_->AttachCompositorFrameSink(
111 server_id(), std::move(sink_request), std::move(client));
112 return std::move(compositor_frame_sink);
113 }
114
115 WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange( 96 WindowPortMus::ServerChangeIdType WindowPortMus::ScheduleChange(
116 const ServerChangeType type, 97 const ServerChangeType type,
117 const ServerChangeData& data) { 98 const ServerChangeData& data) {
118 ServerChange change; 99 ServerChange change;
119 change.type = type; 100 change.type = type;
120 change.server_change_id = next_server_change_id_++; 101 change.server_change_id = next_server_change_id_++;
121 change.data = data; 102 change.data = data;
122 server_changes_.push_back(change); 103 server_changes_.push_back(change);
123 return change.server_change_id; 104 return change.server_change_id;
124 } 105 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 GetPropertyConverter()->GetTransportNameForPropertyKey(key); 465 GetPropertyConverter()->GetTransportNameForPropertyKey(key);
485 // TODO(sky): investigate to see if we need to compare data. In particular do 466 // TODO(sky): investigate to see if we need to compare data. In particular do
486 // we ever have a case where changing a property cascades into changing the 467 // we ever have a case where changing a property cascades into changing the
487 // same property? 468 // same property?
488 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) 469 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data))
489 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, 470 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value,
490 std::move(data)); 471 std::move(data));
491 } 472 }
492 473
493 std::unique_ptr<cc::CompositorFrameSink> 474 std::unique_ptr<cc::CompositorFrameSink>
494 WindowPortMus::CreateCompositorFrameSink() { 475 WindowPortMus::CreateCompositorFrameSink(
495 // TODO(penghuang): Implement it for Mus. 476 scoped_refptr<cc::ContextProvider> context_provider,
496 return nullptr; 477 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) {
478 DCHECK_NE(window_mus_type(), WindowMusType::EMBED_IN_OWNER);
479 DCHECK_NE(window_mus_type(), WindowMusType::TOP_LEVEL_IN_WM);
Fady Samuel 2017/05/26 20:19:28 I think you need to rebase...there's another type
Peng 2017/05/26 20:41:31 As offline discussion, we don't need add another D
480
481 cc::mojom::MojoCompositorFrameSinkPtrInfo sink_info;
482 cc::mojom::MojoCompositorFrameSinkRequest sink_request =
483 mojo::MakeRequest(&sink_info);
484 cc::mojom::MojoCompositorFrameSinkClientPtr client;
485 cc::mojom::MojoCompositorFrameSinkClientRequest client_request =
486 mojo::MakeRequest(&client);
487 auto compositor_frame_sink = base::MakeUnique<viz::ClientCompositorFrameSink>(
488 std::move(context_provider), gpu_memory_buffer_manager,
489 std::move(sink_info), std::move(client_request),
490 window_tree_client_->enable_surface_synchronization_);
491 window_tree_client_->AttachCompositorFrameSink(
492 server_id(), std::move(sink_request), std::move(client));
493 return std::move(compositor_frame_sink);
497 } 494 }
498 495
499 cc::SurfaceId WindowPortMus::GetSurfaceId() const { 496 cc::SurfaceId WindowPortMus::GetSurfaceId() const {
500 // TODO(penghuang): Implement it for Mus. 497 // This method is only used by exo unittests which are not running against
498 // mus, so don't implement it now.
501 return cc::SurfaceId(); 499 return cc::SurfaceId();
502 } 500 }
503 501
504 void WindowPortMus::UpdatePrimarySurfaceInfo() { 502 void WindowPortMus::UpdatePrimarySurfaceInfo() {
505 bool embeds_surface = 503 bool embeds_surface =
506 window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || 504 window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
507 window_mus_type() == WindowMusType::EMBED_IN_OWNER || 505 window_mus_type() == WindowMusType::EMBED_IN_OWNER ||
508 window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED; 506 window_mus_type() == WindowMusType::DISPLAY_MANUALLY_CREATED;
509 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_) 507 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_)
510 return; 508 return;
511 509
512 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) 510 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid())
513 return; 511 return;
514 512
515 SetPrimarySurfaceInfo( 513 SetPrimarySurfaceInfo(
516 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), 514 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_),
517 ScaleFactorForDisplay(window_), last_surface_size_)); 515 ScaleFactorForDisplay(window_), last_surface_size_));
518 } 516 }
519 517
520 void WindowPortMus::UpdateClientSurfaceEmbedder() { 518 void WindowPortMus::UpdateClientSurfaceEmbedder() {
521 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM ||
522 window_mus_type() == WindowMusType::EMBED_IN_OWNER;
523 if (!embeds_surface)
524 return;
525
526 if (!client_surface_embedder_) { 519 if (!client_surface_embedder_) {
527 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( 520 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>(
528 window_, window_tree_client_->normal_client_area_insets_); 521 window_, window_tree_client_->normal_client_area_insets_);
529 } 522 }
530 523
531 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); 524 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_);
532 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); 525 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_);
533 } 526 }
534 527
535 } // namespace aura 528 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698