| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/surfaces/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/surfaces/display.h" | 9 #include "cc/surfaces/display.h" |
| 10 #include "cc/surfaces/surface.h" | 10 #include "cc/surfaces/surface.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 delegated_surface_id_ = surface_id_allocator_->GenerateId(); | 69 delegated_surface_id_ = surface_id_allocator_->GenerateId(); |
| 70 factory_.Create(delegated_surface_id_); | 70 factory_.Create(delegated_surface_id_); |
| 71 last_swap_frame_size_ = frame_size; | 71 last_swap_frame_size_ = frame_size; |
| 72 } | 72 } |
| 73 display_->SetSurfaceId(delegated_surface_id_, | 73 display_->SetSurfaceId(delegated_surface_id_, |
| 74 frame.metadata.device_scale_factor); | 74 frame.metadata.device_scale_factor); |
| 75 | 75 |
| 76 factory_.SubmitCompositorFrame( | 76 factory_.SubmitCompositorFrame( |
| 77 delegated_surface_id_, std::move(frame), | 77 delegated_surface_id_, std::move(frame), |
| 78 base::Bind(&SurfaceDisplayOutputSurface::DidDrawCallback, | 78 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, |
| 79 base::Unretained(this))); | 79 base::Unretained(this))); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { | 82 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 83 DCHECK(thread_checker_.CalledOnValidThread()); | 83 DCHECK(thread_checker_.CalledOnValidThread()); |
| 84 | 84 |
| 85 surface_manager_->RegisterSurfaceFactoryClient( | 85 surface_manager_->RegisterSurfaceFactoryClient( |
| 86 surface_id_allocator_->client_id(), this); | 86 surface_id_allocator_->client_id(), this); |
| 87 | 87 |
| 88 if (!OutputSurface::BindToClient(client)) | 88 if (!OutputSurface::BindToClient(client)) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void SurfaceDisplayOutputSurface::DisplayOutputSurfaceLost() { | 146 void SurfaceDisplayOutputSurface::DisplayOutputSurfaceLost() { |
| 147 output_surface_lost_ = true; | 147 output_surface_lost_ = true; |
| 148 DidLoseOutputSurface(); | 148 DidLoseOutputSurface(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void SurfaceDisplayOutputSurface::DisplaySetMemoryPolicy( | 151 void SurfaceDisplayOutputSurface::DisplaySetMemoryPolicy( |
| 152 const ManagedMemoryPolicy& policy) { | 152 const ManagedMemoryPolicy& policy) { |
| 153 SetMemoryPolicy(policy); | 153 SetMemoryPolicy(policy); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void SurfaceDisplayOutputSurface::DisplayWillDrawAndSwap( | 156 void SurfaceDisplayOutputSurface::SwapBuffersComplete() { |
| 157 bool will_draw_and_swap, | |
| 158 const RenderPassList& render_passes) { | |
| 159 // This notification is not relevant to our client outside of tests. | |
| 160 } | |
| 161 | |
| 162 void SurfaceDisplayOutputSurface::DisplayDidDrawAndSwap() { | |
| 163 // This notification is not relevant to our client outside of tests. We | |
| 164 // unblock the client from DidDrawCallback() when the surface is going to | |
| 165 // be drawn. | |
| 166 } | |
| 167 | |
| 168 void SurfaceDisplayOutputSurface::DidDrawCallback() { | |
| 169 // TODO(danakj): Why the lost check? | 157 // TODO(danakj): Why the lost check? |
| 170 if (!output_surface_lost_) | 158 if (!output_surface_lost_) |
| 171 client_->DidSwapBuffersComplete(); | 159 client_->DidSwapBuffersComplete(); |
| 172 } | 160 } |
| 173 | 161 |
| 174 } // namespace cc | 162 } // namespace cc |
| OLD | NEW |