| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 #include "wtf/text/StringBuilder.h" | 104 #include "wtf/text/StringBuilder.h" |
| 105 #include "wtf/text/StringUTF8Adaptor.h" | 105 #include "wtf/text/StringUTF8Adaptor.h" |
| 106 #include "wtf/typed_arrays/ArrayBufferContents.h" | 106 #include "wtf/typed_arrays/ArrayBufferContents.h" |
| 107 | 107 |
| 108 namespace blink { | 108 namespace blink { |
| 109 | 109 |
| 110 namespace { | 110 namespace { |
| 111 | 111 |
| 112 const double secondsBetweenRestoreAttempts = 1.0; | 112 const double secondsBetweenRestoreAttempts = 1.0; |
| 113 const int maxGLErrorsAllowedToConsole = 256; | 113 const int maxGLErrorsAllowedToConsole = 256; |
| 114 const unsigned maxGLActiveContextsOnWorker = 4; |
| 115 |
| 116 #if OS(ANDROID) |
| 117 const unsigned maxGLActiveContexts = 8; |
| 118 #else // OS(ANDROID) |
| 114 const unsigned maxGLActiveContexts = 16; | 119 const unsigned maxGLActiveContexts = 16; |
| 115 const unsigned maxGLActiveContextsOnWorker = 4; | 120 #endif // OS(ANDROID) |
| 116 | 121 |
| 117 unsigned currentMaxGLContexts() { | 122 unsigned currentMaxGLContexts() { |
| 118 return isMainThread() ? maxGLActiveContexts : maxGLActiveContextsOnWorker; | 123 return isMainThread() ? maxGLActiveContexts : maxGLActiveContextsOnWorker; |
| 119 } | 124 } |
| 120 | 125 |
| 121 using WebGLRenderingContextBaseSet = | 126 using WebGLRenderingContextBaseSet = |
| 122 PersistentHeapHashSet<WeakMember<WebGLRenderingContextBase>>; | 127 PersistentHeapHashSet<WeakMember<WebGLRenderingContextBase>>; |
| 123 WebGLRenderingContextBaseSet& activeContexts() { | 128 WebGLRenderingContextBaseSet& activeContexts() { |
| 124 DEFINE_THREAD_SAFE_STATIC_LOCAL( | 129 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
| 125 ThreadSpecific<WebGLRenderingContextBaseSet>, activeContexts, | 130 ThreadSpecific<WebGLRenderingContextBaseSet>, activeContexts, |
| (...skipping 7712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7838 | 7843 |
| 7839 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7844 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
| 7840 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7845 HTMLCanvasElementOrOffscreenCanvas& result) const { |
| 7841 if (canvas()) | 7846 if (canvas()) |
| 7842 result.setHTMLCanvasElement(canvas()); | 7847 result.setHTMLCanvasElement(canvas()); |
| 7843 else | 7848 else |
| 7844 result.setOffscreenCanvas(offscreenCanvas()); | 7849 result.setOffscreenCanvas(offscreenCanvas()); |
| 7845 } | 7850 } |
| 7846 | 7851 |
| 7847 } // namespace blink | 7852 } // namespace blink |
| OLD | NEW |