| 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/ids.h" | 9 #include "services/ui/ws/ids.h" |
| 10 #include "services/ui/ws/server_window.h" | 10 #include "services/ui/ws/server_window.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 73 } | 73 } |
| 74 | |
| 75 data.surface_sequence_generator.set_frame_sink_id(frame_sink_id); | |
| 76 } | 74 } |
| 77 | 75 |
| 78 void ServerWindowCompositorFrameSinkManager::AddChildFrameSinkId( | 76 void ServerWindowCompositorFrameSinkManager::AddChildFrameSinkId( |
| 79 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 77 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 80 const cc::FrameSinkId& frame_sink_id) { | 78 const cc::FrameSinkId& frame_sink_id) { |
| 81 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); | 79 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); |
| 82 if (it != type_to_compositor_frame_sink_map_.end()) { | 80 if (it != type_to_compositor_frame_sink_map_.end()) { |
| 83 it->second.compositor_frame_sink->AddChildFrameSink(frame_sink_id); | 81 it->second.compositor_frame_sink->AddChildFrameSink(frame_sink_id); |
| 84 return; | 82 return; |
| 85 } | 83 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 mojom::CompositorFrameSinkType type) const { | 100 mojom::CompositorFrameSinkType type) const { |
| 103 return type_to_compositor_frame_sink_map_.count(type) > 0; | 101 return type_to_compositor_frame_sink_map_.count(type) > 0; |
| 104 } | 102 } |
| 105 | 103 |
| 106 bool ServerWindowCompositorFrameSinkManager::HasAnyCompositorFrameSink() const { | 104 bool ServerWindowCompositorFrameSinkManager::HasAnyCompositorFrameSink() const { |
| 107 return HasCompositorFrameSinkOfType( | 105 return HasCompositorFrameSinkOfType( |
| 108 mojom::CompositorFrameSinkType::DEFAULT) || | 106 mojom::CompositorFrameSinkType::DEFAULT) || |
| 109 HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType::UNDERLAY); | 107 HasCompositorFrameSinkOfType(mojom::CompositorFrameSinkType::UNDERLAY); |
| 110 } | 108 } |
| 111 | 109 |
| 112 cc::SurfaceSequence | |
| 113 ServerWindowCompositorFrameSinkManager::CreateSurfaceSequence( | |
| 114 mojom::CompositorFrameSinkType type) { | |
| 115 cc::FrameSinkId frame_sink_id(WindowIdToTransportId(window_->id()), | |
| 116 static_cast<uint32_t>(type)); | |
| 117 CompositorFrameSinkData& data = type_to_compositor_frame_sink_map_[type]; | |
| 118 data.surface_sequence_generator.set_frame_sink_id(frame_sink_id); | |
| 119 return data.surface_sequence_generator.CreateSurfaceSequence(); | |
| 120 } | |
| 121 | |
| 122 gfx::Size ServerWindowCompositorFrameSinkManager::GetLatestFrameSize( | 110 gfx::Size ServerWindowCompositorFrameSinkManager::GetLatestFrameSize( |
| 123 mojom::CompositorFrameSinkType type) const { | 111 mojom::CompositorFrameSinkType type) const { |
| 124 auto it = type_to_compositor_frame_sink_map_.find(type); | 112 auto it = type_to_compositor_frame_sink_map_.find(type); |
| 125 if (it == type_to_compositor_frame_sink_map_.end()) | 113 if (it == type_to_compositor_frame_sink_map_.end()) |
| 126 return gfx::Size(); | 114 return gfx::Size(); |
| 127 | 115 |
| 128 return it->second.latest_submitted_frame_size; | 116 return it->second.latest_submitted_frame_size; |
| 129 } | 117 } |
| 130 | 118 |
| 131 cc::SurfaceId ServerWindowCompositorFrameSinkManager::GetLatestSurfaceId( | 119 cc::SurfaceId ServerWindowCompositorFrameSinkManager::GetLatestSurfaceId( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 164 |
| 177 CompositorFrameSinkData& CompositorFrameSinkData::operator=( | 165 CompositorFrameSinkData& CompositorFrameSinkData::operator=( |
| 178 CompositorFrameSinkData&& other) { | 166 CompositorFrameSinkData&& other) { |
| 179 latest_submitted_surface_id = other.latest_submitted_surface_id; | 167 latest_submitted_surface_id = other.latest_submitted_surface_id; |
| 180 compositor_frame_sink = std::move(other.compositor_frame_sink); | 168 compositor_frame_sink = std::move(other.compositor_frame_sink); |
| 181 return *this; | 169 return *this; |
| 182 } | 170 } |
| 183 | 171 |
| 184 } // namespace ws | 172 } // namespace ws |
| 185 } // namespace ui | 173 } // namespace ui |
| OLD | NEW |