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" | |
10 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
11 #include "services/ui/public/cpp/window_surface.h" | 10 #include "services/ui/public/cpp/window_surface.h" |
12 | 11 |
13 namespace ui { | 12 namespace ui { |
14 | 13 |
15 OutputSurface::OutputSurface( | 14 OutputSurface::OutputSurface( |
16 const scoped_refptr<cc::ContextProvider>& context_provider, | 15 const scoped_refptr<cc::ContextProvider>& context_provider, |
17 std::unique_ptr<ui::WindowSurface> surface) | 16 std::unique_ptr<ui::WindowSurface> surface) |
18 : cc::OutputSurface(context_provider, nullptr, nullptr), | 17 : cc::OutputSurface(context_provider, nullptr, nullptr), |
19 surface_(std::move(surface)) { | 18 surface_(std::move(surface)) { |
(...skipping 29 matching lines...) Expand all Loading... |
49 // destroyed then SubmitCompositorFrame's callback will never get called. | 48 // destroyed then SubmitCompositorFrame's callback will never get called. |
50 // Thus, base::Unretained is safe here. | 49 // Thus, base::Unretained is safe here. |
51 surface_->SubmitCompositorFrame( | 50 surface_->SubmitCompositorFrame( |
52 std::move(frame), | 51 std::move(frame), |
53 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); | 52 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); |
54 } | 53 } |
55 | 54 |
56 void OutputSurface::OnResourcesReturned( | 55 void OutputSurface::OnResourcesReturned( |
57 ui::WindowSurface* surface, | 56 ui::WindowSurface* surface, |
58 mojo::Array<cc::ReturnedResource> resources) { | 57 mojo::Array<cc::ReturnedResource> resources) { |
59 cc::CompositorFrameAck cfa; | 58 ReclaimResources(resources.To<cc::ReturnedResourceArray>()); |
60 cfa.resources = resources.To<cc::ReturnedResourceArray>(); | |
61 ReclaimResources(&cfa); | |
62 } | 59 } |
63 | 60 |
64 void OutputSurface::SwapBuffersComplete() { | 61 void OutputSurface::SwapBuffersComplete() { |
65 client_->DidSwapBuffersComplete(); | 62 client_->DidSwapBuffersComplete(); |
66 } | 63 } |
67 | 64 |
68 } // namespace ui | 65 } // namespace ui |
OLD | NEW |