| 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_compositor_frame_sink_manager.h" | 5 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/bindings/strong_binding.h" | 7 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 8 #include "services/ui/surfaces/display_compositor.h" | 8 #include "services/ui/surfaces/display_compositor.h" |
| 9 #include "services/ui/ws/gpu_compositor_frame_sink.h" |
| 9 #include "services/ui/ws/ids.h" | 10 #include "services/ui/ws/ids.h" |
| 10 #include "services/ui/ws/server_window.h" | 11 #include "services/ui/ws/server_window.h" |
| 11 #include "services/ui/ws/server_window_compositor_frame_sink.h" | |
| 12 #include "services/ui/ws/server_window_delegate.h" | 12 #include "services/ui/ws/server_window_delegate.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 namespace ws { | 15 namespace ws { |
| 16 | 16 |
| 17 ServerWindowCompositorFrameSinkManager::ServerWindowCompositorFrameSinkManager( | 17 ServerWindowCompositorFrameSinkManager::ServerWindowCompositorFrameSinkManager( |
| 18 ServerWindow* window) | 18 ServerWindow* window) |
| 19 : window_(window), | 19 : window_(window), |
| 20 waiting_for_initial_frames_( | 20 waiting_for_initial_frames_( |
| 21 window_->properties().count(ui::mojom::kWaitForUnderlay_Property) > | 21 window_->properties().count(ui::mojom::kWaitForUnderlay_Property) > |
| (...skipping 30 matching lines...) Expand all Loading... |
| 52 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request; | 52 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request; |
| 53 if (data.pending_compositor_frame_sink_request.is_pending()) { | 53 if (data.pending_compositor_frame_sink_request.is_pending()) { |
| 54 private_request = std::move(data.pending_compositor_frame_sink_request); | 54 private_request = std::move(data.pending_compositor_frame_sink_request); |
| 55 } else { | 55 } else { |
| 56 private_request = mojo::GetProxy(&data.compositor_frame_sink); | 56 private_request = mojo::GetProxy(&data.compositor_frame_sink); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // TODO(fsamuel): Create the CompositorFrameSink through the DisplayCompositor | 59 // TODO(fsamuel): Create the CompositorFrameSink through the DisplayCompositor |
| 60 // mojo interface. | 60 // mojo interface. |
| 61 mojo::MakeStrongBinding( | 61 mojo::MakeStrongBinding( |
| 62 base::MakeUnique<ServerWindowCompositorFrameSink>( | 62 base::MakeUnique<GpuCompositorFrameSink>( |
| 63 window_->delegate()->GetDisplayCompositor(), frame_sink_id, widget, | 63 window_->delegate()->GetDisplayCompositor(), frame_sink_id, widget, |
| 64 gpu_memory_buffer_manager, std::move(context_provider), | 64 gpu_memory_buffer_manager, std::move(context_provider), |
| 65 std::move(request), std::move(client)), | 65 std::move(request), std::move(client)), |
| 66 std::move(private_request)); | 66 std::move(private_request)); |
| 67 if (window_->parent()) { | 67 if (window_->parent()) { |
| 68 window_->delegate() | 68 window_->delegate() |
| 69 ->GetRootWindow(window_) | 69 ->GetRootWindow(window_) |
| 70 ->GetOrCreateCompositorFrameSinkManager() | 70 ->GetOrCreateCompositorFrameSinkManager() |
| 71 ->AddChildFrameSinkId(mojom::CompositorFrameSinkType::DEFAULT, | 71 ->AddChildFrameSinkId(mojom::CompositorFrameSinkType::DEFAULT, |
| 72 frame_sink_id); | 72 frame_sink_id); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 void ServerWindowCompositorFrameSinkManager::SetLatestSurfaceInfo( | 128 void ServerWindowCompositorFrameSinkManager::SetLatestSurfaceInfo( |
| 129 mojom::CompositorFrameSinkType type, | 129 mojom::CompositorFrameSinkType type, |
| 130 const cc::SurfaceId& surface_id, | 130 const cc::SurfaceId& surface_id, |
| 131 const gfx::Size& frame_size) { | 131 const gfx::Size& frame_size) { |
| 132 CompositorFrameSinkData& data = type_to_compositor_frame_sink_map_[type]; | 132 CompositorFrameSinkData& data = type_to_compositor_frame_sink_map_[type]; |
| 133 data.latest_submitted_surface_id = surface_id; | 133 data.latest_submitted_surface_id = surface_id; |
| 134 data.latest_submitted_frame_size = frame_size; | 134 data.latest_submitted_frame_size = frame_size; |
| 135 } | 135 } |
| 136 | 136 |
| 137 cc::SurfaceManager* | |
| 138 ServerWindowCompositorFrameSinkManager::GetCompositorFrameSinkManager() { | |
| 139 return window()->delegate()->GetDisplayCompositor()->manager(); | |
| 140 } | |
| 141 | |
| 142 bool ServerWindowCompositorFrameSinkManager:: | 137 bool ServerWindowCompositorFrameSinkManager:: |
| 143 IsCompositorFrameSinkReadyAndNonEmpty( | 138 IsCompositorFrameSinkReadyAndNonEmpty( |
| 144 mojom::CompositorFrameSinkType type) const { | 139 mojom::CompositorFrameSinkType type) const { |
| 145 auto iter = type_to_compositor_frame_sink_map_.find(type); | 140 auto iter = type_to_compositor_frame_sink_map_.find(type); |
| 146 if (iter == type_to_compositor_frame_sink_map_.end()) | 141 if (iter == type_to_compositor_frame_sink_map_.end()) |
| 147 return false; | 142 return false; |
| 148 if (iter->second.latest_submitted_frame_size.IsEmpty()) | 143 if (iter->second.latest_submitted_frame_size.IsEmpty()) |
| 149 return false; | 144 return false; |
| 150 const gfx::Size& latest_submitted_frame_size = | 145 const gfx::Size& latest_submitted_frame_size = |
| 151 iter->second.latest_submitted_frame_size; | 146 iter->second.latest_submitted_frame_size; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 164 | 159 |
| 165 CompositorFrameSinkData& CompositorFrameSinkData::operator=( | 160 CompositorFrameSinkData& CompositorFrameSinkData::operator=( |
| 166 CompositorFrameSinkData&& other) { | 161 CompositorFrameSinkData&& other) { |
| 167 latest_submitted_surface_id = other.latest_submitted_surface_id; | 162 latest_submitted_surface_id = other.latest_submitted_surface_id; |
| 168 compositor_frame_sink = std::move(other.compositor_frame_sink); | 163 compositor_frame_sink = std::move(other.compositor_frame_sink); |
| 169 return *this; | 164 return *this; |
| 170 } | 165 } |
| 171 | 166 |
| 172 } // namespace ws | 167 } // namespace ws |
| 173 } // namespace ui | 168 } // namespace ui |
| OLD | NEW |