OLD | NEW |
---|---|
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/env.h" | |
10 #include "ui/aura/mus/client_surface_embedder.h" | 11 #include "ui/aura/mus/client_surface_embedder.h" |
11 #include "ui/aura/mus/property_converter.h" | 12 #include "ui/aura/mus/property_converter.h" |
12 #include "ui/aura/mus/window_tree_client.h" | 13 #include "ui/aura/mus/window_tree_client.h" |
13 #include "ui/aura/mus/window_tree_client_delegate.h" | 14 #include "ui/aura/mus/window_tree_client_delegate.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
17 #include "ui/base/class_property.h" | 18 #include "ui/base/class_property.h" |
18 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
19 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 489 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
489 // TODO(sky): investigate to see if we need to compare data. In particular do | 490 // 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 | 491 // we ever have a case where changing a property cascades into changing the |
491 // same property? | 492 // same property? |
492 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 493 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
493 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, | 494 window_tree_client_->OnWindowMusPropertyChanged(this, key, old_value, |
494 std::move(data)); | 495 std::move(data)); |
495 } | 496 } |
496 | 497 |
497 std::unique_ptr<cc::CompositorFrameSink> | 498 std::unique_ptr<cc::CompositorFrameSink> |
498 WindowPortMus::CreateCompositorFrameSink() { | 499 WindowPortMus::CreateCompositorFrameSink() { |
Fady Samuel
2017/05/18 20:02:02
This is super confusing. We have a RequestComposit
Peng
2017/05/18 20:51:00
Done
| |
499 // TODO(penghuang): Implement it for Mus. | 500 // We only allow creating a compositor frame sink for a local window. |
500 return nullptr; | 501 if (window_mus_type() != WindowMusType::LOCAL) |
502 return nullptr; | |
503 | |
504 ui::ContextFactory* context_factory = | |
505 aura::Env::GetInstance()->context_factory(); | |
506 std::unique_ptr<ui::ClientCompositorFrameSinkBinding> frame_sink_binding; | |
507 // The compositor frame sink is for a local window, so we don't need surface | |
508 // synchronization. | |
509 const bool enable_surface_synchronization = false; | |
Fady Samuel
2017/05/18 20:02:02
Surface synchronization is actually a requirement
Peng
2017/05/18 20:50:59
As my understanding, when the the CompositorFrameS
Fady Samuel
2017/05/18 20:56:22
Without surface synchronization, there is no guara
Peng
2017/05/23 18:00:42
Done.
| |
510 std::unique_ptr<ui::ClientCompositorFrameSink> frame_sink = | |
511 ui::ClientCompositorFrameSink::Create( | |
512 nullptr /* context_provider */, | |
513 context_factory->GetGpuMemoryBufferManager(), &frame_sink_binding, | |
514 enable_surface_synchronization); | |
515 AttachCompositorFrameSink(std::move(frame_sink_binding)); | |
516 return std::move(frame_sink); | |
501 } | 517 } |
502 | 518 |
503 cc::SurfaceId WindowPortMus::GetSurfaceId() const { | 519 cc::SurfaceId WindowPortMus::GetSurfaceId() const { |
504 // TODO(penghuang): Implement it for Mus. | 520 // This method is only used by exo unittests which are not running against |
521 // mus, so don't implement it now. | |
505 return cc::SurfaceId(); | 522 return cc::SurfaceId(); |
506 } | 523 } |
507 | 524 |
508 void WindowPortMus::UpdatePrimarySurfaceInfo() { | 525 void WindowPortMus::UpdatePrimarySurfaceInfo() { |
509 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || | 526 bool embeds_surface = window_mus_type() == WindowMusType::TOP_LEVEL_IN_WM || |
510 window_mus_type() == WindowMusType::EMBED_IN_OWNER; | 527 window_mus_type() == WindowMusType::EMBED_IN_OWNER; |
511 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_) | 528 if (!embeds_surface || !window_tree_client_->enable_surface_synchronization_) |
512 return; | 529 return; |
513 | 530 |
514 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) | 531 if (!frame_sink_id_.is_valid() || !local_surface_id_.is_valid()) |
515 return; | 532 return; |
516 | 533 |
517 SetPrimarySurfaceInfo( | 534 SetPrimarySurfaceInfo( |
518 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), | 535 cc::SurfaceInfo(cc::SurfaceId(frame_sink_id_, local_surface_id_), |
519 ScaleFactorForDisplay(window_), last_surface_size_)); | 536 ScaleFactorForDisplay(window_), last_surface_size_)); |
520 } | 537 } |
521 | 538 |
522 void WindowPortMus::UpdateClientSurfaceEmbedder() { | 539 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_) { | 540 if (!client_surface_embedder_) { |
529 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( | 541 client_surface_embedder_ = base::MakeUnique<ClientSurfaceEmbedder>( |
530 window_, window_tree_client_->normal_client_area_insets_); | 542 window_, window_tree_client_->normal_client_area_insets_); |
531 } | 543 } |
532 | 544 |
533 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); | 545 client_surface_embedder_->SetPrimarySurfaceInfo(primary_surface_info_); |
534 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); | 546 client_surface_embedder_->SetFallbackSurfaceInfo(fallback_surface_info_); |
535 } | 547 } |
536 | 548 |
537 } // namespace aura | 549 } // namespace aura |
OLD | NEW |