OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 WebGraphicsContext3D* DrawingBuffer::context() | 187 WebGraphicsContext3D* DrawingBuffer::context() |
188 { | 188 { |
189 return m_context.get(); | 189 return m_context.get(); |
190 } | 190 } |
191 | 191 |
192 void DrawingBuffer::setIsHidden(bool hidden) | 192 void DrawingBuffer::setIsHidden(bool hidden) |
193 { | 193 { |
194 if (m_isHidden == hidden) | 194 if (m_isHidden == hidden) |
195 return; | 195 return; |
196 m_isHidden = hidden; | 196 m_isHidden = hidden; |
197 if (m_isHidden) | 197 if (m_isHidden && !m_context->isContextLost()) |
danakj
2014/09/10 15:11:49
Can you explain why you don't free mailboxes when
Justin Novosad
2014/09/10 17:09:50
Had a similar issue with 2D canvas. It's because y
danakj
2014/09/10 17:12:12
I'm not sure why you can't delete things? You can
Justin Novosad
2014/09/10 17:16:24
It's the deleting of mailboxes that was causing tr
danakj
2014/09/10 17:18:11
As long as we don't use them anything is okay, but
| |
198 freeRecycledMailboxes(); | 198 freeRecycledMailboxes(); |
199 } | 199 } |
200 | 200 |
201 void DrawingBuffer::freeRecycledMailboxes() | 201 void DrawingBuffer::freeRecycledMailboxes() |
202 { | 202 { |
203 if (m_recycledMailboxQueue.isEmpty()) | 203 if (m_recycledMailboxQueue.isEmpty()) |
204 return; | 204 return; |
205 while (!m_recycledMailboxQueue.isEmpty()) | 205 while (!m_recycledMailboxQueue.isEmpty()) |
206 deleteMailbox(m_recycledMailboxQueue.takeLast()); | 206 deleteMailbox(m_recycledMailboxQueue.takeLast()); |
207 } | 207 } |
208 | 208 |
209 bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt ernalBitmap* bitmap) | 209 bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt ernalBitmap* bitmap) |
210 { | 210 { |
211 ASSERT(!m_isHidden); | |
212 if (!m_contentsChanged) | |
213 return false; | |
214 | |
215 if (m_destructionInProgress) { | 211 if (m_destructionInProgress) { |
216 // It can be hit in the following sequence. | 212 // It can be hit in the following sequence. |
217 // 1. WebGL draws something. | 213 // 1. WebGL draws something. |
218 // 2. The compositor begins the frame. | 214 // 2. The compositor begins the frame. |
219 // 3. Javascript makes a context lost using WEBGL_lose_context extension . | 215 // 3. Javascript makes a context lost using WEBGL_lose_context extension . |
220 // 4. Here. | 216 // 4. Here. |
221 return false; | 217 return false; |
222 } | 218 } |
219 ASSERT(!m_isHidden); | |
220 if (!m_contentsChanged) | |
221 return false; | |
223 | 222 |
224 // Resolve the multisampled buffer into m_colorBuffer texture. | 223 // Resolve the multisampled buffer into m_colorBuffer texture. |
225 if (m_multisampleMode != None) | 224 if (m_multisampleMode != None) |
226 commit(); | 225 commit(); |
227 | 226 |
228 if (bitmap) { | 227 if (bitmap) { |
229 bitmap->setSize(size()); | 228 bitmap->setSize(size()); |
230 | 229 |
231 unsigned char* pixels = bitmap->pixels(); | 230 unsigned char* pixels = bitmap->pixels(); |
232 bool needPremultiply = m_actualAttributes.alpha && !m_actualAttributes.p remultipliedAlpha; | 231 bool needPremultiply = m_actualAttributes.alpha && !m_actualAttributes.p remultipliedAlpha; |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1047 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1046 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
1048 { | 1047 { |
1049 if (info->imageId) { | 1048 if (info->imageId) { |
1050 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1049 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
1051 m_context->destroyImageCHROMIUM(info->imageId); | 1050 m_context->destroyImageCHROMIUM(info->imageId); |
1052 info->imageId = 0; | 1051 info->imageId = 0; |
1053 } | 1052 } |
1054 } | 1053 } |
1055 | 1054 |
1056 } // namespace blink | 1055 } // namespace blink |
OLD | NEW |