| 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/command_buffer/client/gles2_interface.h" |   7 #include "gpu/command_buffer/client/gles2_interface.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/WebGraphicsContext3D.h" |  10 #include "public/platform/WebGraphicsContext3D.h" | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  43         return; |  43         return; | 
|  44  |  44  | 
|  45     gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); |  45     gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); | 
|  46  |  46  | 
|  47     if (!gl || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |  47     if (!gl || gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) | 
|  48         return; |  48         return; | 
|  49  |  49  | 
|  50     WebGraphicsContext3D* context = m_contextProvider->context3d(); |  50     WebGraphicsContext3D* context = m_contextProvider->context3d(); | 
|  51     m_queries.append(m_canUseSyncQueries ? context->createQueryEXT() : 0); |  51     m_queries.append(m_canUseSyncQueries ? context->createQueryEXT() : 0); | 
|  52     if (m_canUseSyncQueries) { |  52     if (m_canUseSyncQueries) { | 
|  53         context->beginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last())
    ; |  53         gl->BeginQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM, m_queries.last()); | 
|  54         context->endQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); |  54         gl->EndQueryEXT(GL_COMMANDS_COMPLETED_CHROMIUM); | 
|  55     } |  55     } | 
|  56     if (m_queries.size() > m_maxPendingTicks) { |  56     if (m_queries.size() > m_maxPendingTicks) { | 
|  57         if (m_canUseSyncQueries) { |  57         if (m_canUseSyncQueries) { | 
|  58             WGC3Duint result; |  58             WGC3Duint result; | 
|  59             context->getQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT
    , &result); |  59             gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &re
    sult); | 
|  60             context->deleteQueryEXT(m_queries.first()); |  60             context->deleteQueryEXT(m_queries.first()); | 
|  61             m_queries.removeFirst(); |  61             m_queries.removeFirst(); | 
|  62         } else { |  62         } else { | 
|  63             context->finish(); |  63             gl->Finish(); | 
|  64             reset(); |  64             reset(); | 
|  65         } |  65         } | 
|  66     } |  66     } | 
|  67 } |  67 } | 
|  68  |  68  | 
|  69 void SharedContextRateLimiter::reset() |  69 void SharedContextRateLimiter::reset() | 
|  70 { |  70 { | 
|  71     if (!m_contextProvider) |  71     if (!m_contextProvider) | 
|  72         return; |  72         return; | 
|  73  |  73  | 
|  74     gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); |  74     gpu::gles2::GLES2Interface* gl = m_contextProvider->contextGL(); | 
|  75     if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { |  75     if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { | 
|  76         WebGraphicsContext3D* context = m_contextProvider->context3d(); |  76         WebGraphicsContext3D* context = m_contextProvider->context3d(); | 
|  77         while (m_queries.size() > 0) { |  77         while (m_queries.size() > 0) { | 
|  78             context->deleteQueryEXT(m_queries.first()); |  78             context->deleteQueryEXT(m_queries.first()); | 
|  79             m_queries.removeFirst(); |  79             m_queries.removeFirst(); | 
|  80         } |  80         } | 
|  81     } else { |  81     } else { | 
|  82         m_queries.clear(); |  82         m_queries.clear(); | 
|  83     } |  83     } | 
|  84 } |  84 } | 
|  85  |  85  | 
|  86 } // namespace blink |  86 } // namespace blink | 
| OLD | NEW |