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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // destroyed then SubmitCompositorFrame's callback will never get called. | 50 // destroyed then SubmitCompositorFrame's callback will never get called. |
52 // Thus, base::Unretained is safe here. | 51 // Thus, base::Unretained is safe here. |
53 surface_->SubmitCompositorFrame( | 52 surface_->SubmitCompositorFrame( |
54 std::move(frame), | 53 std::move(frame), |
55 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); | 54 base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this))); |
56 } | 55 } |
57 | 56 |
58 void OutputSurface::OnResourcesReturned( | 57 void OutputSurface::OnResourcesReturned( |
59 ui::WindowSurface* surface, | 58 ui::WindowSurface* surface, |
60 mojo::Array<cc::ReturnedResource> resources) { | 59 mojo::Array<cc::ReturnedResource> resources) { |
61 cc::CompositorFrameAck cfa; | 60 ReclaimResources(resources.To<cc::ReturnedResourceArray>()); |
62 cfa.resources = resources.To<cc::ReturnedResourceArray>(); | |
63 ReclaimResources(&cfa); | |
64 } | 61 } |
65 | 62 |
66 void OutputSurface::SwapBuffersComplete() { | 63 void OutputSurface::SwapBuffersComplete() { |
67 client_->DidSwapBuffersComplete(); | 64 client_->DidSwapBuffersComplete(); |
68 } | 65 } |
69 | 66 |
70 } // namespace ui | 67 } // namespace ui |
OLD | NEW |