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