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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibi
lity"); | 112 m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibi
lity"); |
113 | 113 |
114 if (extensions.count("GL_CHROMIUM_iosurface")) | 114 if (extensions.count("GL_CHROMIUM_iosurface")) |
115 DCHECK(extensions.count("GL_ARB_texture_rectangle")); | 115 DCHECK(extensions.count("GL_ARB_texture_rectangle")); |
116 | 116 |
117 m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_mem
ory_manager"); | 117 m_capabilities.usingGpuMemoryManager = extensions.count("GL_CHROMIUM_gpu_mem
ory_manager"); |
118 if (m_capabilities.usingGpuMemoryManager) | 118 if (m_capabilities.usingGpuMemoryManager) |
119 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); | 119 m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); |
120 | 120 |
| 121 m_context->setLatencyInfoCallbackCHROMIUM(this); |
| 122 |
121 m_capabilities.usingDiscardBackbuffer = extensions.count("GL_CHROMIUM_discar
d_backbuffer"); | 123 m_capabilities.usingDiscardBackbuffer = extensions.count("GL_CHROMIUM_discar
d_backbuffer"); |
122 | 124 |
123 m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external")
; | 125 m_capabilities.usingEglImage = extensions.count("GL_OES_EGL_image_external")
; |
124 | 126 |
125 m_capabilities.maxTextureSize = m_resourceProvider->maxTextureSize(); | 127 m_capabilities.maxTextureSize = m_resourceProvider->maxTextureSize(); |
126 m_capabilities.bestTextureFormat = m_resourceProvider->bestTextureFormat(); | 128 m_capabilities.bestTextureFormat = m_resourceProvider->bestTextureFormat(); |
127 | 129 |
128 // The updater can access textures while the GLRenderer is using them. | 130 // The updater can access textures while the GLRenderer is using them. |
129 m_capabilities.allowPartialTextureUpdates = true; | 131 m_capabilities.allowPartialTextureUpdates = true; |
130 | 132 |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 m_swapBufferRect = gfx::Rect(); | 1266 m_swapBufferRect = gfx::Rect(); |
1265 | 1267 |
1266 return true; | 1268 return true; |
1267 } | 1269 } |
1268 | 1270 |
1269 void GLRenderer::onSwapBuffersComplete() | 1271 void GLRenderer::onSwapBuffersComplete() |
1270 { | 1272 { |
1271 m_client->onSwapBuffersComplete(); | 1273 m_client->onSwapBuffersComplete(); |
1272 } | 1274 } |
1273 | 1275 |
| 1276 void GLRenderer::setLatencyInfo(const WebKit::WebLatencyInfoImpl& latency_info) |
| 1277 { |
| 1278 m_context->setLatencyInfoCHROMIUM(static_cast<const WebKit::WebLatencyInfo&>
(latency_info)); |
| 1279 } |
| 1280 |
| 1281 void GLRenderer::onReceivedLatencyInfo(const WebKit::WebLatencyInfo& latency_inf
o) |
| 1282 { |
| 1283 m_client->onReceivedLatencyInfo(static_cast<const WebKit::WebLatencyInfoImpl
&>(latency_info)); |
| 1284 } |
| 1285 |
1274 void GLRenderer::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocatio
n) | 1286 void GLRenderer::onMemoryAllocationChanged(WebGraphicsMemoryAllocation allocatio
n) |
1275 { | 1287 { |
1276 // Just ignore the memory manager when it says to set the limit to zero | 1288 // Just ignore the memory manager when it says to set the limit to zero |
1277 // bytes. This will happen when the memory manager thinks that the renderer | 1289 // bytes. This will happen when the memory manager thinks that the renderer |
1278 // is not visible (which the renderer knows better). | 1290 // is not visible (which the renderer knows better). |
1279 if (allocation.bytesLimitWhenVisible) { | 1291 if (allocation.bytesLimitWhenVisible) { |
1280 ManagedMemoryPolicy policy( | 1292 ManagedMemoryPolicy policy( |
1281 allocation.bytesLimitWhenVisible, | 1293 allocation.bytesLimitWhenVisible, |
1282 priorityCutoffValue(allocation.priorityCutoffWhenVisible), | 1294 priorityCutoffValue(allocation.priorityCutoffWhenVisible), |
1283 allocation.bytesLimitWhenNotVisible, | 1295 allocation.bytesLimitWhenNotVisible, |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 | 1760 |
1749 releaseRenderPassTextures(); | 1761 releaseRenderPassTextures(); |
1750 } | 1762 } |
1751 | 1763 |
1752 bool GLRenderer::isContextLost() | 1764 bool GLRenderer::isContextLost() |
1753 { | 1765 { |
1754 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1766 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1755 } | 1767 } |
1756 | 1768 |
1757 } // namespace cc | 1769 } // namespace cc |
OLD | NEW |