| 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/output/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (!delegated_surface_id_.is_null()) { | 67 if (!delegated_surface_id_.is_null()) { |
| 68 factory_.Destroy(delegated_surface_id_); | 68 factory_.Destroy(delegated_surface_id_); |
| 69 } | 69 } |
| 70 delegated_surface_id_ = surface_id_allocator_->GenerateId(); | 70 delegated_surface_id_ = surface_id_allocator_->GenerateId(); |
| 71 factory_.Create(delegated_surface_id_); | 71 factory_.Create(delegated_surface_id_); |
| 72 last_swap_frame_size_ = frame_size; | 72 last_swap_frame_size_ = frame_size; |
| 73 } | 73 } |
| 74 display_->SetSurfaceId(delegated_surface_id_, | 74 display_->SetSurfaceId(delegated_surface_id_, |
| 75 frame.metadata.device_scale_factor); | 75 frame.metadata.device_scale_factor); |
| 76 | 76 |
| 77 client_->DidSwapBuffers(); | |
| 78 | |
| 79 factory_.SubmitCompositorFrame( | 77 factory_.SubmitCompositorFrame( |
| 80 delegated_surface_id_, std::move(frame), | 78 delegated_surface_id_, std::move(frame), |
| 81 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, | 79 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, |
| 82 base::Unretained(this))); | 80 base::Unretained(this))); |
| 83 } | 81 } |
| 84 | 82 |
| 85 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { | 83 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 86 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
| 87 | 85 |
| 88 surface_manager_->RegisterSurfaceFactoryClient( | 86 surface_manager_->RegisterSurfaceFactoryClient( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 SetMemoryPolicy(policy); | 155 SetMemoryPolicy(policy); |
| 158 } | 156 } |
| 159 | 157 |
| 160 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 158 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
| 161 // TODO(danakj): Why the lost check? | 159 // TODO(danakj): Why the lost check? |
| 162 if (!output_surface_lost_) | 160 if (!output_surface_lost_) |
| 163 client_->DidSwapBuffersComplete(); | 161 client_->DidSwapBuffersComplete(); |
| 164 } | 162 } |
| 165 | 163 |
| 166 } // namespace cc | 164 } // namespace cc |
| OLD | NEW |