| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 59 gl->DeleteQueriesEXT(1, &m_queries.first()); | 59 gl->DeleteQueriesEXT(1, &m_queries.first()); |
| 60 m_queries.removeFirst(); | 60 m_queries.pop_front(); |
| 61 } else { | 61 } else { |
| 62 gl->Finish(); | 62 gl->Finish(); |
| 63 reset(); | 63 reset(); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SharedContextRateLimiter::reset() { | 68 void SharedContextRateLimiter::reset() { |
| 69 if (!m_contextProvider) | 69 if (!m_contextProvider) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); | 72 gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); |
| 73 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { | 73 if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { |
| 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.pop_front(); |
| 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 |