| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "platform/graphics/gpu/SharedContextRateLimiter.h" | 5 #include "platform/graphics/gpu/SharedContextRateLimiter.h" |
| 6 | 6 |
| 7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
| 8 #include "platform/graphics/gpu/Extensions3DUtil.h" | 8 #include "platform/graphics/gpu/Extensions3DUtil.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebGraphicsContext3DProvider.h" | 10 #include "public/platform/WebGraphicsContext3DProvider.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SharedContextRateLimiter::tick() { | 40 void SharedContextRateLimiter::tick() { |
| 41 if (!m_contextProvider) | 41 if (!m_contextProvider) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); | 44 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); |
| 45 if (!gl || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) | 45 if (!gl || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
| 46 return; | 46 return; |
| 47 | 47 |
| 48 m_queries.append(0); | 48 m_queries.push_back(0); |
| 49 if (m_canUseSyncQueries) | 49 if (m_canUseSyncQueries) |
| 50 gl->GenQueriesEXT(1, &m_queries.last()); | 50 gl->GenQueriesEXT(1, &m_queries.last()); |
| 51 if (m_canUseSyncQueries) { | 51 if (m_canUseSyncQueries) { |
| 52 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); | 52 gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); |
| 53 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 53 gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |
| 54 } | 54 } |
| 55 if (m_queries.size() > m_maxPendingTicks) { | 55 if (m_queries.size() > m_maxPendingTicks) { |
| 56 if (m_canUseSyncQueries) { | 56 if (m_canUseSyncQueries) { |
| 57 GLuint result; | 57 GLuint result; |
| 58 gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &result); | 58 gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &result); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 while (m_queries.size() > 0) { | 74 while (m_queries.size() > 0) { |
| 75 gl->DeleteQueriesEXT(1, &m_queries.first()); | 75 gl->DeleteQueriesEXT(1, &m_queries.first()); |
| 76 m_queries.removeFirst(); | 76 m_queries.removeFirst(); |
| 77 } | 77 } |
| 78 } else { | 78 } else { |
| 79 m_queries.clear(); | 79 m_queries.clear(); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |