| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 ContextProvider* context_provider = output_surface_->context_provider(); | 154 ContextProvider* context_provider = output_surface_->context_provider(); |
| 155 if (!visible_) { | 155 if (!visible_) { |
| 156 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); | 156 TRACE_EVENT0("cc", "DelegatingRenderer::SetVisible dropping resources"); |
| 157 resource_provider_->ReleaseCachedData(); | 157 resource_provider_->ReleaseCachedData(); |
| 158 if (context_provider) | 158 if (context_provider) |
| 159 context_provider->ContextGL()->Flush(); | 159 context_provider->ContextGL()->Flush(); |
| 160 } | 160 } |
| 161 // We loop visibility to the GPU process, since that's what manages memory. | 161 // We loop visibility to the GPU process, since that's what manages memory. |
| 162 // That will allow it to feed us with memory allocations that we can act | 162 // That will allow it to feed us with memory allocations that we can act |
| 163 // upon. | 163 // upon. |
| 164 DCHECK(context_provider); | 164 if (context_provider) |
| 165 context_provider->ContextSupport()->SetSurfaceVisible(visible); | 165 context_provider->ContextSupport()->SetSurfaceVisible(visible); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void DelegatingRenderer::SendManagedMemoryStats(size_t bytes_visible, | 168 void DelegatingRenderer::SendManagedMemoryStats(size_t bytes_visible, |
| 169 size_t bytes_visible_and_nearby, | 169 size_t bytes_visible_and_nearby, |
| 170 size_t bytes_allocated) { | 170 size_t bytes_allocated) { |
| 171 ContextProvider* context_provider = output_surface_->context_provider(); | 171 ContextProvider* context_provider = output_surface_->context_provider(); |
| 172 if (!context_provider) { | 172 if (!context_provider) { |
| 173 // TODO(piman): software path. | 173 // TODO(piman): software path. |
| 174 NOTIMPLEMENTED(); | 174 NOTIMPLEMENTED(); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 gpu::ManagedMemoryStats stats; | 177 gpu::ManagedMemoryStats stats; |
| 178 stats.bytes_required = bytes_visible; | 178 stats.bytes_required = bytes_visible; |
| 179 stats.bytes_nice_to_have = bytes_visible_and_nearby; | 179 stats.bytes_nice_to_have = bytes_visible_and_nearby; |
| 180 stats.bytes_allocated = bytes_allocated; | 180 stats.bytes_allocated = bytes_allocated; |
| 181 stats.backbuffer_requested = false; | 181 stats.backbuffer_requested = false; |
| 182 | 182 |
| 183 context_provider->ContextSupport()->SendManagedMemoryStats(stats); | 183 context_provider->ContextSupport()->SendManagedMemoryStats(stats); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace cc | 186 } // namespace cc |
| OLD | NEW |