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 "cc/surfaces/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_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/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { | 69 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { |
70 DCHECK(client); | 70 DCHECK(client); |
71 DCHECK(display_client_); | 71 DCHECK(display_client_); |
72 client_ = client; | 72 client_ = client; |
73 // Avoid initializing GL context here, as this should be sharing the | 73 // Avoid initializing GL context here, as this should be sharing the |
74 // Display's context. | 74 // Display's context. |
75 return display_client_->Initialize(); | 75 return display_client_->Initialize(); |
76 } | 76 } |
77 | 77 |
78 void SurfaceDisplayOutputSurface::ForceReclaimResources() { | 78 void SurfaceDisplayOutputSurface::ForceReclaimResources() { |
79 if (!surface_id_.is_null()) | 79 if (!surface_id_.is_null()) { |
80 factory_.SubmitFrame(surface_id_, nullptr, SurfaceFactory::DrawCallback()); | 80 scoped_ptr<CompositorFrame> empty_frame(new CompositorFrame()); |
| 81 empty_frame->delegated_frame_data.reset(new DelegatedFrameData); |
| 82 factory_.SubmitFrame(surface_id_, empty_frame.Pass(), |
| 83 SurfaceFactory::DrawCallback()); |
| 84 } |
81 } | 85 } |
82 | 86 |
83 void SurfaceDisplayOutputSurface::ReturnResources( | 87 void SurfaceDisplayOutputSurface::ReturnResources( |
84 const ReturnedResourceArray& resources) { | 88 const ReturnedResourceArray& resources) { |
85 CompositorFrameAck ack; | 89 CompositorFrameAck ack; |
86 ack.resources = resources; | 90 ack.resources = resources; |
87 if (client_) | 91 if (client_) |
88 client_->ReclaimResources(&ack); | 92 client_->ReclaimResources(&ack); |
89 } | 93 } |
90 | 94 |
91 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 95 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
92 if (client_ && !display_client_->output_surface_lost()) | 96 if (client_ && !display_client_->output_surface_lost()) |
93 client_->DidSwapBuffersComplete(); | 97 client_->DidSwapBuffersComplete(); |
94 } | 98 } |
95 | 99 |
96 } // namespace cc | 100 } // namespace cc |
OLD | NEW |