| 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 "services/ui/ws/server_window_surface_manager.h" | 5 #include "services/ui/ws/server_window_surface_manager.h" |
| 6 | 6 |
| 7 #include "services/ui/surfaces/display_compositor.h" | 7 #include "services/ui/surfaces/display_compositor.h" |
| 8 #include "services/ui/ws/ids.h" |
| 8 #include "services/ui/ws/server_window.h" | 9 #include "services/ui/ws/server_window.h" |
| 9 #include "services/ui/ws/server_window_delegate.h" | 10 #include "services/ui/ws/server_window_delegate.h" |
| 10 #include "services/ui/ws/server_window_surface.h" | 11 #include "services/ui/ws/server_window_surface.h" |
| 11 | 12 |
| 12 namespace ui { | 13 namespace ui { |
| 13 namespace ws { | 14 namespace ws { |
| 14 | 15 |
| 15 ServerWindowSurfaceManager::ServerWindowSurfaceManager(ServerWindow* window) | 16 ServerWindowSurfaceManager::ServerWindowSurfaceManager(ServerWindow* window) |
| 16 : window_(window), | 17 : window_(window), |
| 17 waiting_for_initial_frames_( | 18 waiting_for_initial_frames_( |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 waiting_for_initial_frames_ = | 33 waiting_for_initial_frames_ = |
| 33 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::DEFAULT) || | 34 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::DEFAULT) || |
| 34 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::UNDERLAY); | 35 !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::UNDERLAY); |
| 35 return !waiting_for_initial_frames_; | 36 return !waiting_for_initial_frames_; |
| 36 } | 37 } |
| 37 | 38 |
| 38 void ServerWindowSurfaceManager::CreateSurface( | 39 void ServerWindowSurfaceManager::CreateSurface( |
| 39 mojom::SurfaceType surface_type, | 40 mojom::SurfaceType surface_type, |
| 40 mojo::InterfaceRequest<mojom::Surface> request, | 41 mojo::InterfaceRequest<mojom::Surface> request, |
| 41 mojom::SurfaceClientPtr client) { | 42 mojom::SurfaceClientPtr client) { |
| 42 std::unique_ptr<ServerWindowSurface> surface( | 43 cc::FrameSinkId frame_sink_id(WindowIdToTransportId(window_->id()), |
| 43 new ServerWindowSurface(this, std::move(request), std::move(client))); | 44 static_cast<uint32_t>(surface_type)); |
| 45 std::unique_ptr<ServerWindowSurface> surface(new ServerWindowSurface( |
| 46 this, frame_sink_id, std::move(request), std::move(client))); |
| 44 type_to_surface_map_[surface_type] = std::move(surface); | 47 type_to_surface_map_[surface_type] = std::move(surface); |
| 45 } | 48 } |
| 46 | 49 |
| 47 ServerWindowSurface* ServerWindowSurfaceManager::GetDefaultSurface() const { | 50 ServerWindowSurface* ServerWindowSurfaceManager::GetDefaultSurface() const { |
| 48 return GetSurfaceByType(mojom::SurfaceType::DEFAULT); | 51 return GetSurfaceByType(mojom::SurfaceType::DEFAULT); |
| 49 } | 52 } |
| 50 | 53 |
| 51 ServerWindowSurface* ServerWindowSurfaceManager::GetUnderlaySurface() const { | 54 ServerWindowSurface* ServerWindowSurfaceManager::GetUnderlaySurface() const { |
| 52 return GetSurfaceByType(mojom::SurfaceType::UNDERLAY); | 55 return GetSurfaceByType(mojom::SurfaceType::UNDERLAY); |
| 53 } | 56 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 79 if (iter->second->last_submitted_frame_size().IsEmpty()) | 82 if (iter->second->last_submitted_frame_size().IsEmpty()) |
| 80 return false; | 83 return false; |
| 81 const gfx::Size& last_submitted_frame_size = | 84 const gfx::Size& last_submitted_frame_size = |
| 82 iter->second->last_submitted_frame_size(); | 85 iter->second->last_submitted_frame_size(); |
| 83 return last_submitted_frame_size.width() >= window_->bounds().width() && | 86 return last_submitted_frame_size.width() >= window_->bounds().width() && |
| 84 last_submitted_frame_size.height() >= window_->bounds().height(); | 87 last_submitted_frame_size.height() >= window_->bounds().height(); |
| 85 } | 88 } |
| 86 | 89 |
| 87 } // namespace ws | 90 } // namespace ws |
| 88 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |