| 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 16 matching lines...) Expand all  Loading... | 
| 27   surface_->BindToThread(); | 27   surface_->BindToThread(); | 
| 28   surface_->set_client(this); | 28   surface_->set_client(this); | 
| 29   return cc::OutputSurface::BindToClient(client); | 29   return cc::OutputSurface::BindToClient(client); | 
| 30 } | 30 } | 
| 31 | 31 | 
| 32 void OutputSurface::DetachFromClient() { | 32 void OutputSurface::DetachFromClient() { | 
| 33   surface_.reset(); | 33   surface_.reset(); | 
| 34   cc::OutputSurface::DetachFromClient(); | 34   cc::OutputSurface::DetachFromClient(); | 
| 35 } | 35 } | 
| 36 | 36 | 
|  | 37 void OutputSurface::BindFramebuffer() { | 
|  | 38   // This is a delegating output surface, no framebuffer/direct drawing support. | 
|  | 39   NOTREACHED(); | 
|  | 40 } | 
|  | 41 | 
|  | 42 uint32_t OutputSurface::GetFramebufferCopyTextureFormat() { | 
|  | 43   // This is a delegating output surface, no framebuffer/direct drawing support. | 
|  | 44   NOTREACHED(); | 
|  | 45   return 0; | 
|  | 46 } | 
|  | 47 | 
| 37 void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 48 void OutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 
| 38   // TODO(fsamuel, rjkroege): We should probably throttle compositor frames. | 49   // TODO(fsamuel, rjkroege): We should probably throttle compositor frames. | 
| 39   client_->DidSwapBuffers(); | 50   client_->DidSwapBuffers(); | 
| 40   // OutputSurface owns WindowSurface, and so if OutputSurface is | 51   // OutputSurface owns WindowSurface, and so if OutputSurface is | 
| 41   // destroyed then SubmitCompositorFrame's callback will never get called. | 52   // destroyed then SubmitCompositorFrame's callback will never get called. | 
| 42   // Thus, base::Unretained is safe here. | 53   // Thus, base::Unretained is safe here. | 
| 43   surface_->SubmitCompositorFrame( | 54   surface_->SubmitCompositorFrame( | 
| 44       cc::mojom::CompositorFrame::From(*frame), | 55       cc::mojom::CompositorFrame::From(*frame), | 
| 45       base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); | 56       base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); | 
| 46 } | 57 } | 
| 47 | 58 | 
| 48 void OutputSurface::OnResourcesReturned( | 59 void OutputSurface::OnResourcesReturned( | 
| 49     mus::WindowSurface* surface, | 60     mus::WindowSurface* surface, | 
| 50     mojo::Array<cc::ReturnedResource> resources) { | 61     mojo::Array<cc::ReturnedResource> resources) { | 
| 51   cc::CompositorFrameAck cfa; | 62   cc::CompositorFrameAck cfa; | 
| 52   cfa.resources = resources.To<cc::ReturnedResourceArray>(); | 63   cfa.resources = resources.To<cc::ReturnedResourceArray>(); | 
| 53   ReclaimResources(&cfa); | 64   ReclaimResources(&cfa); | 
| 54 } | 65 } | 
| 55 | 66 | 
| 56 void OutputSurface::SwapBuffersComplete() { | 67 void OutputSurface::SwapBuffersComplete() { | 
| 57   client_->DidSwapBuffersComplete(); | 68   client_->DidSwapBuffersComplete(); | 
| 58 } | 69 } | 
| 59 | 70 | 
| 60 }  // namespace mus | 71 }  // namespace mus | 
| OLD | NEW | 
|---|