| 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 |
| 124 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) | 140 void WebGLRenderingContextBase::forciblyLoseOldestContext(const String& reason) |
| 125 { | 141 { |
| 126 WebGLRenderingContextBase* candidate = oldestContext(); | 142 WebGLRenderingContextBase* candidate = oldestContext(); |
| 127 if (!candidate) | 143 if (!candidate) |
| 128 return; | 144 return; |
| 129 | 145 |
| 130 // This context could belong to a dead page and the last JavaScript referenc
e has already | 146 // This context could belong to a dead page and the last JavaScript referenc
e has already |
| 131 // been lost. Garbage collection might be triggered in the middle of this fu
nction, for | 147 // been lost. Garbage collection might be triggered in the middle of this fu
nction, for |
| 132 // example, printWarningToConsole() causes an upcall to JavaScript. | 148 // example, printWarningToConsole() causes an upcall to JavaScript. |
| 133 // Must make sure that the context is not deleted until the call stack unwin
ds. | 149 // 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... |
| 6928 | 6944 |
| 6929 return totalBytesPerPixel; | 6945 return totalBytesPerPixel; |
| 6930 } | 6946 } |
| 6931 | 6947 |
| 6932 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 6948 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 6933 { | 6949 { |
| 6934 return m_drawingBuffer.get(); | 6950 return m_drawingBuffer.get(); |
| 6935 } | 6951 } |
| 6936 | 6952 |
| 6937 } // namespace blink | 6953 } // namespace blink |
| OLD | NEW |