| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 if (!activeContexts().contains(context)) | 155 if (!activeContexts().contains(context)) |
| 156 activeContexts().append(context); | 156 activeContexts().append(context); |
| 157 | 157 |
| 158 if (activeContexts().size() > maxGLActiveContexts) | 158 if (activeContexts().size() > maxGLActiveContexts) |
| 159 forciblyLoseOldestContext("WARNING: Too many active WebGL contexts. Olde
st context will be lost."); | 159 forciblyLoseOldestContext("WARNING: Too many active WebGL contexts. Olde
st context will be lost."); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void WebGLRenderingContext::deactivateContext(WebGLRenderingContext* context, bo
ol addToEvictedList) | 162 void WebGLRenderingContext::deactivateContext(WebGLRenderingContext* context, bo
ol addToEvictedList) |
| 163 { | 163 { |
| 164 size_t position = activeContexts().find(context); | 164 size_t position = activeContexts().find(context); |
| 165 if (position != WTF::notFound) | 165 if (position != WTF::kNotFound) |
| 166 activeContexts().remove(position); | 166 activeContexts().remove(position); |
| 167 | 167 |
| 168 if (addToEvictedList && !forciblyEvictedContexts().contains(context)) | 168 if (addToEvictedList && !forciblyEvictedContexts().contains(context)) |
| 169 forciblyEvictedContexts().append(context); | 169 forciblyEvictedContexts().append(context); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context) | 172 void WebGLRenderingContext::willDestroyContext(WebGLRenderingContext* context) |
| 173 { | 173 { |
| 174 size_t position = forciblyEvictedContexts().find(context); | 174 size_t position = forciblyEvictedContexts().find(context); |
| 175 if (position != WTF::notFound) | 175 if (position != WTF::kNotFound) |
| 176 forciblyEvictedContexts().remove(position); | 176 forciblyEvictedContexts().remove(position); |
| 177 | 177 |
| 178 deactivateContext(context, false); | 178 deactivateContext(context, false); |
| 179 | 179 |
| 180 // Try to re-enable the oldest inactive contexts. | 180 // Try to re-enable the oldest inactive contexts. |
| 181 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex
ts().size()) { | 181 while(activeContexts().size() < maxGLActiveContexts && forciblyEvictedContex
ts().size()) { |
| 182 WebGLRenderingContext* evictedContext = forciblyEvictedContexts().first(
); | 182 WebGLRenderingContext* evictedContext = forciblyEvictedContexts().first(
); |
| 183 if (!evictedContext->m_restoreAllowed) { | 183 if (!evictedContext->m_restoreAllowed) { |
| 184 forciblyEvictedContexts().remove(0); | 184 forciblyEvictedContexts().remove(0); |
| 185 continue; | 185 continue; |
| (...skipping 5288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5474 void WebGLRenderingContext::synthesizeGLError(GC3Denum error, const char* functi
onName, const char* description, ConsoleDisplayPreference display) | 5474 void WebGLRenderingContext::synthesizeGLError(GC3Denum error, const char* functi
onName, const char* description, ConsoleDisplayPreference display) |
| 5475 { | 5475 { |
| 5476 String errorType = GetErrorString(error); | 5476 String errorType = GetErrorString(error); |
| 5477 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { | 5477 if (m_synthesizedErrorsToConsole && display == DisplayInConsole) { |
| 5478 String message = String("WebGL: ") + errorType + ": " + String(function
Name) + ": " + String(description); | 5478 String message = String("WebGL: ") + errorType + ": " + String(function
Name) + ": " + String(description); |
| 5479 printGLErrorToConsole(message); | 5479 printGLErrorToConsole(message); |
| 5480 } | 5480 } |
| 5481 if (!isContextLost()) | 5481 if (!isContextLost()) |
| 5482 m_context->synthesizeGLError(error); | 5482 m_context->synthesizeGLError(error); |
| 5483 else { | 5483 else { |
| 5484 if (lost_context_errors_.find(error) == WTF::notFound) | 5484 if (lost_context_errors_.find(error) == WTF::kNotFound) |
| 5485 lost_context_errors_.append(error); | 5485 lost_context_errors_.append(error); |
| 5486 } | 5486 } |
| 5487 InspectorInstrumentation::didFireWebGLError(canvas(), errorType); | 5487 InspectorInstrumentation::didFireWebGLError(canvas(), errorType); |
| 5488 } | 5488 } |
| 5489 | 5489 |
| 5490 void WebGLRenderingContext::emitGLWarning(const char* functionName, const char*
description) | 5490 void WebGLRenderingContext::emitGLWarning(const char* functionName, const char*
description) |
| 5491 { | 5491 { |
| 5492 if (m_synthesizedErrorsToConsole) { | 5492 if (m_synthesizedErrorsToConsole) { |
| 5493 String message = String("WebGL: ") + String(functionName) + ": " + Strin
g(description); | 5493 String message = String("WebGL: ") + String(functionName) + ": " + Strin
g(description); |
| 5494 printGLErrorToConsole(message); | 5494 printGLErrorToConsole(message); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5591 if (m_textureUnits[i].m_texture2DBinding | 5591 if (m_textureUnits[i].m_texture2DBinding |
| 5592 || m_textureUnits[i].m_textureCubeMapBinding) { | 5592 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5593 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5593 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5594 return; | 5594 return; |
| 5595 } | 5595 } |
| 5596 } | 5596 } |
| 5597 m_onePlusMaxNonDefaultTextureUnit = 0; | 5597 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5598 } | 5598 } |
| 5599 | 5599 |
| 5600 } // namespace WebCore | 5600 } // namespace WebCore |
| OLD | NEW |