OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 compositor_frame.metadata = metadata; | 105 compositor_frame.metadata = metadata; |
106 compositor_frame.delegated_frame_data = delegated_frame_data_.Pass(); | 106 compositor_frame.delegated_frame_data = delegated_frame_data_.Pass(); |
107 output_surface_->SwapBuffers(&compositor_frame); | 107 output_surface_->SwapBuffers(&compositor_frame); |
108 } | 108 } |
109 | 109 |
110 void DelegatingRenderer::ReceiveSwapBuffersAck( | 110 void DelegatingRenderer::ReceiveSwapBuffersAck( |
111 const CompositorFrameAck& ack) { | 111 const CompositorFrameAck& ack) { |
112 resource_provider_->ReceiveReturnsFromParent(ack.resources); | 112 resource_provider_->ReceiveReturnsFromParent(ack.resources); |
113 } | 113 } |
114 | 114 |
115 bool DelegatingRenderer::IsContextLost() { | |
116 ContextProvider* context_provider = output_surface_->context_provider(); | |
117 if (!context_provider) | |
118 return false; | |
119 return context_provider->IsContextLost(); | |
120 } | |
121 | |
122 void DelegatingRenderer::DidChangeVisibility() { | 115 void DelegatingRenderer::DidChangeVisibility() { |
123 ContextProvider* context_provider = output_surface_->context_provider(); | 116 ContextProvider* context_provider = output_surface_->context_provider(); |
124 if (!visible()) { | 117 if (!visible()) { |
125 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); | 118 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); |
126 resource_provider_->ReleaseCachedData(); | 119 resource_provider_->ReleaseCachedData(); |
127 if (context_provider) { | 120 if (context_provider) { |
128 context_provider->DeleteCachedResources(); | 121 context_provider->DeleteCachedResources(); |
129 context_provider->ContextGL()->Flush(); | 122 context_provider->ContextGL()->Flush(); |
130 } | 123 } |
131 } | 124 } |
132 // We loop visibility to the GPU process, since that's what manages memory. | 125 // We loop visibility to the GPU process, since that's what manages memory. |
133 // That will allow it to feed us with memory allocations that we can act | 126 // That will allow it to feed us with memory allocations that we can act |
134 // upon. | 127 // upon. |
135 if (context_provider) | 128 if (context_provider) |
136 context_provider->ContextSupport()->SetSurfaceVisible(visible()); | 129 context_provider->ContextSupport()->SetSurfaceVisible(visible()); |
137 } | 130 } |
138 | 131 |
139 } // namespace cc | 132 } // namespace cc |
OLD | NEW |