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