| 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 "services/ui/public/cpp/output_surface.h" | 5 #include "services/ui/public/cpp/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/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 NOTREACHED(); | 38 NOTREACHED(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { | 41 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { |
| 42 // This is a delegating output surface, no framebuffer/direct drawing support. | 42 // This is a delegating output surface, no framebuffer/direct drawing support. |
| 43 NOTREACHED(); | 43 NOTREACHED(); |
| 44 return 0; | 44 return 0; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void OutputSurface::SwapBuffers(cc::CompositorFrame frame) { | 47 void OutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
| 48 // TODO(fsamuel, rjkroege): We should probably throttle compositor frames. | |
| 49 client_->DidSwapBuffers(); | |
| 50 // OutputSurface owns WindowSurface, and so if OutputSurface is | 48 // OutputSurface owns WindowSurface, and so if OutputSurface is |
| 51 // destroyed then SubmitCompositorFrame's callback will never get called. | 49 // destroyed then SubmitCompositorFrame's callback will never get called. |
| 52 // Thus, base::Unretained is safe here. | 50 // Thus, base::Unretained is safe here. |
| 53 surface_->SubmitCompositorFrame( | 51 surface_->SubmitCompositorFrame( |
| 54 std::move(frame), | 52 std::move(frame), |
| 55 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); | 53 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); |
| 56 } | 54 } |
| 57 | 55 |
| 58 void OutputSurface::OnResourcesReturned( | 56 void OutputSurface::OnResourcesReturned( |
| 59 ui::WindowSurface* surface, | 57 ui::WindowSurface* surface, |
| 60 mojo::Array<cc::ReturnedResource> resources) { | 58 mojo::Array<cc::ReturnedResource> resources) { |
| 61 cc::CompositorFrameAck cfa; | 59 cc::CompositorFrameAck cfa; |
| 62 cfa.resources = resources.To<cc::ReturnedResourceArray>(); | 60 cfa.resources = resources.To<cc::ReturnedResourceArray>(); |
| 63 ReclaimResources(&cfa); | 61 ReclaimResources(&cfa); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void OutputSurface::SwapBuffersComplete() { | 64 void OutputSurface::SwapBuffersComplete() { |
| 67 client_->DidSwapBuffersComplete(); | 65 client_->DidSwapBuffersComplete(); |
| 68 } | 66 } |
| 69 | 67 |
| 70 } // namespace ui | 68 } // namespace ui |
| OLD | NEW |