| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 using WebGLRenderingContextBaseMap = WillBePersistentHeapHashMap<RawPtrWillBeWea
kMember<WebGLRenderingContextBase>, int>; | 115 using WebGLRenderingContextBaseMap = WillBePersistentHeapHashMap<RawPtrWillBeWea
kMember<WebGLRenderingContextBase>, int>; |
| 116 WebGLRenderingContextBaseMap& forciblyEvictedContexts() | 116 WebGLRenderingContextBaseMap& forciblyEvictedContexts() |
| 117 { | 117 { |
| 118 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseMap, forciblyEvictedContexts, (
)); | 118 DEFINE_STATIC_LOCAL(WebGLRenderingContextBaseMap, forciblyEvictedContexts, (
)); |
| 119 return forciblyEvictedContexts; | 119 return forciblyEvictedContexts; |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace | 122 } // namespace |
| 123 | 123 |
| 124 WebGLRenderingContextBase::ScopedDrawingBufferBinder::ScopedDrawingBufferBinder(
DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding) | |
| 125 : m_drawingBuffer(drawingBuffer) | |
| 126 , m_readFramebufferBinding(framebufferBinding) | |
| 127 { | |
| 128 // Commit DrawingBuffer if needed (e.g., for multisampling) | |
| 129 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 130 m_drawingBuffer->commit(); | |
| 131 } | |
| 132 | |
| 133 WebGLRenderingContextBase::ScopedDrawingBufferBinder::~ScopedDrawingBufferBinder
() | |
| 134 { | |
| 135 // Restore DrawingBuffer if needed | |
| 136 if (!m_readFramebufferBinding && m_drawingBuffer) | |
| 137 m_drawingBuffer->restoreFramebufferBindings(); | |
| 138 } | |
| 139 | |
| 140 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) | 124 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) |
| 141 { | 125 { |
| 142 WebGLRenderingContextBase* candidate = oldestContext(); | 126 WebGLRenderingContextBase* candidate = oldestContext(); |
| 143 if (!candidate) | 127 if (!candidate) |
| 144 return; | 128 return; |
| 145 | 129 |
| 146 // This context could belong to a dead page and the last JavaScript referenc
e has already | 130 // This context could belong to a dead page and the last JavaScript referenc
e has already |
| 147 // been lost. Garbage collection might be triggered in the middle of this fu
nction, for | 131 // been lost. Garbage collection might be triggered in the middle of this fu
nction, for |
| 148 // example, printWarningToConsole() causes an upcall to JavaScript. | 132 // example, printWarningToConsole() causes an upcall to JavaScript. |
| 149 // Must make sure that the context is not deleted until the call stack unwin
ds. | 133 // Must make sure that the context is not deleted until the call stack unwin
ds. |
| (...skipping 6794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6944 | 6928 |
| 6945 return totalBytesPerPixel; | 6929 return totalBytesPerPixel; |
| 6946 } | 6930 } |
| 6947 | 6931 |
| 6948 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6932 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6949 { | 6933 { |
| 6950 return m_drawingBuffer.get(); | 6934 return m_drawingBuffer.get(); |
| 6951 } | 6935 } |
| 6952 | 6936 |
| 6953 } // namespace blink | 6937 } // namespace blink |
| OLD | NEW |