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 "cc/ipc/display_compositor.mojom.h" | 7 #include "cc/ipc/display_compositor.mojom.h" |
8 #include "mojo/public/cpp/bindings/strong_binding.h" | 8 #include "mojo/public/cpp/bindings/strong_binding.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 57 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
58 const cc::FrameSinkId& frame_sink_id) { | 58 const cc::FrameSinkId& frame_sink_id) { |
59 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); | 59 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); |
60 if (it != type_to_compositor_frame_sink_map_.end()) { | 60 if (it != type_to_compositor_frame_sink_map_.end()) { |
61 it->second.compositor_frame_sink->AddChildFrameSink(frame_sink_id); | 61 it->second.compositor_frame_sink->AddChildFrameSink(frame_sink_id); |
62 return; | 62 return; |
63 } | 63 } |
64 CompositorFrameSinkData& data = | 64 CompositorFrameSinkData& data = |
65 type_to_compositor_frame_sink_map_[compositor_frame_sink_type]; | 65 type_to_compositor_frame_sink_map_[compositor_frame_sink_type]; |
66 data.pending_compositor_frame_sink_request = | 66 data.pending_compositor_frame_sink_request = |
67 mojo::GetProxy(&data.compositor_frame_sink); | 67 mojo::MakeRequest(&data.compositor_frame_sink); |
68 data.compositor_frame_sink->AddChildFrameSink(frame_sink_id); | 68 data.compositor_frame_sink->AddChildFrameSink(frame_sink_id); |
69 } | 69 } |
70 | 70 |
71 void ServerWindowCompositorFrameSinkManager::RemoveChildFrameSinkId( | 71 void ServerWindowCompositorFrameSinkManager::RemoveChildFrameSinkId( |
72 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 72 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
73 const cc::FrameSinkId& frame_sink_id) { | 73 const cc::FrameSinkId& frame_sink_id) { |
74 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); | 74 auto it = type_to_compositor_frame_sink_map_.find(compositor_frame_sink_type); |
75 DCHECK(it != type_to_compositor_frame_sink_map_.end()); | 75 DCHECK(it != type_to_compositor_frame_sink_map_.end()); |
76 it->second.compositor_frame_sink->RemoveChildFrameSink(frame_sink_id); | 76 it->second.compositor_frame_sink->RemoveChildFrameSink(frame_sink_id); |
77 } | 77 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 cc::FrameSinkId frame_sink_id( | 151 cc::FrameSinkId frame_sink_id( |
152 WindowIdToTransportId(window_->id()), | 152 WindowIdToTransportId(window_->id()), |
153 static_cast<uint32_t>(compositor_frame_sink_type)); | 153 static_cast<uint32_t>(compositor_frame_sink_type)); |
154 CompositorFrameSinkData& data = | 154 CompositorFrameSinkData& data = |
155 type_to_compositor_frame_sink_map_[compositor_frame_sink_type]; | 155 type_to_compositor_frame_sink_map_[compositor_frame_sink_type]; |
156 data.frame_sink_id = frame_sink_id; | 156 data.frame_sink_id = frame_sink_id; |
157 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request; | 157 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request; |
158 if (data.pending_compositor_frame_sink_request.is_pending()) { | 158 if (data.pending_compositor_frame_sink_request.is_pending()) { |
159 private_request = std::move(data.pending_compositor_frame_sink_request); | 159 private_request = std::move(data.pending_compositor_frame_sink_request); |
160 } else { | 160 } else { |
161 private_request = mojo::GetProxy(&data.compositor_frame_sink); | 161 private_request = mojo::MakeRequest(&data.compositor_frame_sink); |
162 } | 162 } |
163 | 163 |
164 if (widget != gfx::kNullAcceleratedWidget) { | 164 if (widget != gfx::kNullAcceleratedWidget) { |
165 // TODO(fsamuel): AcceleratedWidget cannot be transported over IPC for Mac | 165 // TODO(fsamuel): AcceleratedWidget cannot be transported over IPC for Mac |
166 // or Android. We should instead use GpuSurfaceTracker here on those | 166 // or Android. We should instead use GpuSurfaceTracker here on those |
167 // platforms. | 167 // platforms. |
168 window_->delegate() | 168 window_->delegate() |
169 ->GetDisplayCompositor() | 169 ->GetDisplayCompositor() |
170 ->CreateDisplayCompositorFrameSink( | 170 ->CreateDisplayCompositorFrameSink( |
171 frame_sink_id, widget, std::move(request), | 171 frame_sink_id, widget, std::move(request), |
(...skipping 26 matching lines...) Expand all Loading... |
198 | 198 |
199 CompositorFrameSinkData& CompositorFrameSinkData::operator=( | 199 CompositorFrameSinkData& CompositorFrameSinkData::operator=( |
200 CompositorFrameSinkData&& other) { | 200 CompositorFrameSinkData&& other) { |
201 latest_submitted_surface_id = other.latest_submitted_surface_id; | 201 latest_submitted_surface_id = other.latest_submitted_surface_id; |
202 compositor_frame_sink = std::move(other.compositor_frame_sink); | 202 compositor_frame_sink = std::move(other.compositor_frame_sink); |
203 return *this; | 203 return *this; |
204 } | 204 } |
205 | 205 |
206 } // namespace ws | 206 } // namespace ws |
207 } // namespace ui | 207 } // namespace ui |
OLD | NEW |