| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/gl_renderer.h" | 5 #include "cc/gl_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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 m_client->setManagedMemoryPolicy(policy); | 1338 m_client->setManagedMemoryPolicy(policy); |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 bool oldDiscardBackbufferWhenNotVisible = m_discardBackbufferWhenNotVisible; | 1341 bool oldDiscardBackbufferWhenNotVisible = m_discardBackbufferWhenNotVisible; |
| 1342 m_discardBackbufferWhenNotVisible = !allocation.suggestHaveBackbuffer; | 1342 m_discardBackbufferWhenNotVisible = !allocation.suggestHaveBackbuffer; |
| 1343 enforceMemoryPolicy(); | 1343 enforceMemoryPolicy(); |
| 1344 if (allocation.enforceButDoNotKeepAsPolicy) | 1344 if (allocation.enforceButDoNotKeepAsPolicy) |
| 1345 m_discardBackbufferWhenNotVisible = oldDiscardBackbufferWhenNotVisible; | 1345 m_discardBackbufferWhenNotVisible = oldDiscardBackbufferWhenNotVisible; |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 int GLRenderer::priorityCutoffValue(WebKit::WebGraphicsMemoryAllocation::Priorit
yCutoff priorityCutoff) | 1348 ManagedMemoryPolicy::PriorityCutoff GLRenderer::priorityCutoffValue(WebKit::WebG
raphicsMemoryAllocation::PriorityCutoff priorityCutoff) |
| 1349 { | 1349 { |
| 1350 switch (priorityCutoff) { | 1350 switch (priorityCutoff) { |
| 1351 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowNothing: | 1351 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowNothing: |
| 1352 return PriorityCalculator::allowNothingCutoff(); | 1352 return ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING; |
| 1353 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowVisibleOnly: | 1353 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowVisibleOnly: |
| 1354 return PriorityCalculator::allowVisibleOnlyCutoff(); | 1354 return ManagedMemoryPolicy::CUTOFF_ALLOW_REQUIRED_ONLY; |
| 1355 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowVisibleAndNearb
y: | 1355 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowVisibleAndNearb
y: |
| 1356 return PriorityCalculator::allowVisibleAndNearbyCutoff(); | 1356 return ManagedMemoryPolicy::CUTOFF_ALLOW_NICE_TO_HAVE; |
| 1357 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowEverything: | 1357 case WebKit::WebGraphicsMemoryAllocation::PriorityCutoffAllowEverything: |
| 1358 return PriorityCalculator::allowEverythingCutoff(); | 1358 return ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING; |
| 1359 } | 1359 } |
| 1360 NOTREACHED(); | 1360 NOTREACHED(); |
| 1361 return 0; | 1361 return ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING; |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 void GLRenderer::enforceMemoryPolicy() | 1364 void GLRenderer::enforceMemoryPolicy() |
| 1365 { | 1365 { |
| 1366 if (!m_visible) { | 1366 if (!m_visible) { |
| 1367 TRACE_EVENT0("cc", "GLRenderer::enforceMemoryPolicy dropping resources")
; | 1367 TRACE_EVENT0("cc", "GLRenderer::enforceMemoryPolicy dropping resources")
; |
| 1368 releaseRenderPassTextures(); | 1368 releaseRenderPassTextures(); |
| 1369 if (m_discardBackbufferWhenNotVisible) | 1369 if (m_discardBackbufferWhenNotVisible) |
| 1370 discardBackbuffer(); | 1370 discardBackbuffer(); |
| 1371 GLC(m_context, m_context->flush()); | 1371 GLC(m_context, m_context->flush()); |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 | 1797 |
| 1798 releaseRenderPassTextures(); | 1798 releaseRenderPassTextures(); |
| 1799 } | 1799 } |
| 1800 | 1800 |
| 1801 bool GLRenderer::isContextLost() | 1801 bool GLRenderer::isContextLost() |
| 1802 { | 1802 { |
| 1803 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1803 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1804 } | 1804 } |
| 1805 | 1805 |
| 1806 } // namespace cc | 1806 } // namespace cc |
| OLD | NEW |