| 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/surfaces/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 child_frame_sink_id); | 96 child_frame_sink_id); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void DisplayCompositor::UnregisterFrameSinkHierarchy( | 99 void DisplayCompositor::UnregisterFrameSinkHierarchy( |
| 100 const cc::FrameSinkId& parent_frame_sink_id, | 100 const cc::FrameSinkId& parent_frame_sink_id, |
| 101 const cc::FrameSinkId& child_frame_sink_id) { | 101 const cc::FrameSinkId& child_frame_sink_id) { |
| 102 manager_.UnregisterFrameSinkHierarchy(parent_frame_sink_id, | 102 manager_.UnregisterFrameSinkHierarchy(parent_frame_sink_id, |
| 103 child_frame_sink_id); | 103 child_frame_sink_id); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void DisplayCompositor::DropTemporaryReference( |
| 107 const cc::SurfaceId& surface_id) { |
| 108 manager_.DropTemporaryReference(surface_id); |
| 109 } |
| 110 |
| 106 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( | 111 std::unique_ptr<cc::Display> DisplayCompositor::CreateDisplay( |
| 107 const cc::FrameSinkId& frame_sink_id, | 112 const cc::FrameSinkId& frame_sink_id, |
| 108 gpu::SurfaceHandle surface_handle, | 113 gpu::SurfaceHandle surface_handle, |
| 109 cc::SyntheticBeginFrameSource* begin_frame_source) { | 114 cc::SyntheticBeginFrameSource* begin_frame_source) { |
| 110 scoped_refptr<cc::InProcessContextProvider> context_provider = | 115 scoped_refptr<cc::InProcessContextProvider> context_provider = |
| 111 new cc::InProcessContextProvider( | 116 new cc::InProcessContextProvider( |
| 112 gpu_service_, surface_handle, gpu_memory_buffer_manager_.get(), | 117 gpu_service_, surface_handle, gpu_memory_buffer_manager_.get(), |
| 113 image_factory_, gpu::SharedMemoryLimits(), | 118 image_factory_, gpu::SharedMemoryLimits(), |
| 114 nullptr /* shared_context */); | 119 nullptr /* shared_context */); |
| 115 | 120 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 156 } |
| 152 | 157 |
| 153 void DisplayCompositor::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) { | 158 void DisplayCompositor::DestroyCompositorFrameSink(cc::FrameSinkId sink_id) { |
| 154 compositor_frame_sinks_.erase(sink_id); | 159 compositor_frame_sinks_.erase(sink_id); |
| 155 } | 160 } |
| 156 | 161 |
| 157 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { | 162 void DisplayCompositor::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { |
| 158 DCHECK(thread_checker_.CalledOnValidThread()); | 163 DCHECK(thread_checker_.CalledOnValidThread()); |
| 159 DCHECK_GT(surface_info.device_scale_factor(), 0.0f); | 164 DCHECK_GT(surface_info.device_scale_factor(), 0.0f); |
| 160 | 165 |
| 166 // TODO(kylechar): |client_| will try to find an owner for the temporary |
| 167 // reference to the new surface. With surface synchronization this might not |
| 168 // be necessary, because a surface reference might already exist and no |
| 169 // temporary reference was created. It could be useful to let |client_| know |
| 170 // if it should find an owner. |
| 161 if (client_) | 171 if (client_) |
| 162 client_->OnSurfaceCreated(surface_info); | 172 client_->OnSurfaceCreated(surface_info); |
| 163 } | 173 } |
| 164 | 174 |
| 165 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, | 175 void DisplayCompositor::OnSurfaceDamaged(const cc::SurfaceId& surface_id, |
| 166 bool* changed) {} | 176 bool* changed) {} |
| 167 | 177 |
| 168 void DisplayCompositor::OnClientConnectionLost( | 178 void DisplayCompositor::OnClientConnectionLost( |
| 169 const cc::FrameSinkId& frame_sink_id, | 179 const cc::FrameSinkId& frame_sink_id, |
| 170 bool destroy_compositor_frame_sink) { | 180 bool destroy_compositor_frame_sink) { |
| 171 DCHECK(thread_checker_.CalledOnValidThread()); | 181 DCHECK(thread_checker_.CalledOnValidThread()); |
| 172 if (destroy_compositor_frame_sink) | 182 if (destroy_compositor_frame_sink) |
| 173 DestroyCompositorFrameSink(frame_sink_id); | 183 DestroyCompositorFrameSink(frame_sink_id); |
| 174 // TODO(fsamuel): Tell the display compositor host that the client connection | 184 // TODO(fsamuel): Tell the display compositor host that the client connection |
| 175 // has been lost so that it can drop its private connection and allow a new | 185 // has been lost so that it can drop its private connection and allow a new |
| 176 // client instance to create a new CompositorFrameSink. | 186 // client instance to create a new CompositorFrameSink. |
| 177 } | 187 } |
| 178 | 188 |
| 179 void DisplayCompositor::OnPrivateConnectionLost( | 189 void DisplayCompositor::OnPrivateConnectionLost( |
| 180 const cc::FrameSinkId& frame_sink_id, | 190 const cc::FrameSinkId& frame_sink_id, |
| 181 bool destroy_compositor_frame_sink) { | 191 bool destroy_compositor_frame_sink) { |
| 182 DCHECK(thread_checker_.CalledOnValidThread()); | 192 DCHECK(thread_checker_.CalledOnValidThread()); |
| 183 if (destroy_compositor_frame_sink) | 193 if (destroy_compositor_frame_sink) |
| 184 DestroyCompositorFrameSink(frame_sink_id); | 194 DestroyCompositorFrameSink(frame_sink_id); |
| 185 } | 195 } |
| 186 | 196 |
| 187 } // namespace ui | 197 } // namespace ui |
| OLD | NEW |