| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/ws/server_window_surface_manager.h" | 5 #include "components/mus/ws/server_window_surface_manager.h" |
| 6 | 6 |
| 7 #include "components/mus/ws/server_window.h" | 7 #include "components/mus/ws/server_window.h" |
| 8 #include "components/mus/ws/server_window_delegate.h" | 8 #include "components/mus/ws/server_window_delegate.h" |
| 9 #include "components/mus/ws/server_window_surface.h" | 9 #include "components/mus/ws/server_window_surface.h" |
| 10 | 10 |
| 11 namespace mus { | 11 namespace mus { |
| 12 namespace ws { | 12 namespace ws { |
| 13 | 13 |
| 14 ServerWindowSurfaceManager::ServerWindowSurfaceManager(ServerWindow* window) | 14 ServerWindowSurfaceManager::ServerWindowSurfaceManager(ServerWindow* window) |
| 15 : window_(window), | 15 : window_(window), |
| 16 surface_id_allocator_(WindowIdToTransportId(window->id())), | 16 surface_id_allocator_(WindowIdToTransportId(window->id())), |
| 17 waiting_for_initial_frames_( | 17 waiting_for_initial_frames_( |
| 18 window_->properties().count(mus::mojom::kWaitForUnderlay_Property) > | 18 window_->properties().count(mus::mojom::kWaitForUnderlay_Property) > |
| 19 0) {} | 19 0) {} |
| 20 | 20 |
| 21 ServerWindowSurfaceManager::~ServerWindowSurfaceManager() {} | 21 ServerWindowSurfaceManager::~ServerWindowSurfaceManager() {} |
| 22 | 22 |
| 23 bool ServerWindowSurfaceManager::ShouldDraw() { | 23 bool ServerWindowSurfaceManager::ShouldDraw() { |
| 24 if (!waiting_for_initial_frames_) | 24 if (!waiting_for_initial_frames_) |
| 25 return true; | 25 return true; |
| 26 | 26 |
| 27 // XXX(sad): We don't have an underlay right now. |
| 27 waiting_for_initial_frames_ = | 28 waiting_for_initial_frames_ = |
| 28 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::DEFAULT) || | 29 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::DEFAULT) /* && |
| 29 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::UNDERLAY); | 30 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::UNDERLAY) */; |
| 30 return !waiting_for_initial_frames_; | 31 return !waiting_for_initial_frames_; |
| 31 } | 32 } |
| 32 | 33 |
| 33 void ServerWindowSurfaceManager::CreateSurface( | 34 void ServerWindowSurfaceManager::CreateSurface( |
| 34 mojom::SurfaceType surface_type, | 35 mojom::SurfaceType surface_type, |
| 35 mojo::InterfaceRequest<mojom::Surface> request, | 36 mojo::InterfaceRequest<mojom::Surface> request, |
| 36 mojom::SurfaceClientPtr client) { | 37 mojom::SurfaceClientPtr client) { |
| 37 type_to_surface_map_[surface_type] = make_scoped_ptr(new ServerWindowSurface( | 38 type_to_surface_map_[surface_type] = make_scoped_ptr(new ServerWindowSurface( |
| 38 this, surface_type, std::move(request), std::move(client))); | 39 this, surface_type, std::move(request), std::move(client))); |
| 39 } | 40 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 68 return last_submitted_frame_size.width() >= window_->bounds().width() && | 69 return last_submitted_frame_size.width() >= window_->bounds().width() && |
| 69 last_submitted_frame_size.height() >= window_->bounds().height(); | 70 last_submitted_frame_size.height() >= window_->bounds().height(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 cc::SurfaceId ServerWindowSurfaceManager::GenerateId() { | 73 cc::SurfaceId ServerWindowSurfaceManager::GenerateId() { |
| 73 return surface_id_allocator_.GenerateId(); | 74 return surface_id_allocator_.GenerateId(); |
| 74 } | 75 } |
| 75 | 76 |
| 76 } // namespace ws | 77 } // namespace ws |
| 77 } // namespace mus | 78 } // namespace mus |
| OLD | NEW |