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