| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 markLayerComposited(); | 269 markLayerComposited(); |
| 270 | 270 |
| 271 // set m_parentDrawingBuffer to make sure 'this' stays alive as long as it h
as live mailboxes | 271 // set m_parentDrawingBuffer to make sure 'this' stays alive as long as it h
as live mailboxes |
| 272 ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer); | 272 ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer); |
| 273 frontColorBufferMailbox->m_parentDrawingBuffer = this; | 273 frontColorBufferMailbox->m_parentDrawingBuffer = this; |
| 274 *outMailbox = frontColorBufferMailbox->mailbox; | 274 *outMailbox = frontColorBufferMailbox->mailbox; |
| 275 m_frontColorBuffer = frontColorBufferMailbox->textureInfo; | 275 m_frontColorBuffer = frontColorBufferMailbox->textureInfo; |
| 276 return true; | 276 return true; |
| 277 } | 277 } |
| 278 | 278 |
| 279 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail
box) | 279 void DrawingBuffer::mailboxReleased(const blink::WebExternalTextureMailbox& mail
box, bool lostResource) |
| 280 { | 280 { |
| 281 if (m_destructionInProgress) { | 281 if (m_destructionInProgress || m_context->isContextLost() || lostResource) { |
| 282 mailboxReleasedWhileDestructionInProgress(mailbox); | 282 mailboxReleasedWhileDestructionInProgress(mailbox); |
| 283 return; | 283 return; |
| 284 } | 284 } |
| 285 | 285 |
| 286 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 286 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
| 287 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; | 287 RefPtr<MailboxInfo> mailboxInfo = m_textureMailboxes[i]; |
| 288 if (nameEquals(mailboxInfo->mailbox, mailbox)) { | 288 if (nameEquals(mailboxInfo->mailbox, mailbox)) { |
| 289 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; | 289 mailboxInfo->mailbox.syncPoint = mailbox.syncPoint; |
| 290 ASSERT(mailboxInfo->m_parentDrawingBuffer.get() == this); | 290 ASSERT(mailboxInfo->m_parentDrawingBuffer.get() == this); |
| 291 mailboxInfo->m_parentDrawingBuffer.clear(); | 291 mailboxInfo->m_parentDrawingBuffer.clear(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 void DrawingBuffer::deleteMailbox(const blink::WebExternalTextureMailbox& mailbo
x) | 347 void DrawingBuffer::deleteMailbox(const blink::WebExternalTextureMailbox& mailbo
x) |
| 348 { | 348 { |
| 349 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 349 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
| 350 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { | 350 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { |
| 351 if (mailbox.syncPoint) | 351 if (mailbox.syncPoint) |
| 352 m_context->waitSyncPoint(mailbox.syncPoint); | 352 m_context->waitSyncPoint(mailbox.syncPoint); |
| 353 | 353 |
| 354 deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo); | 354 deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo); |
| 355 | 355 |
| 356 m_context->deleteTexture(m_textureMailboxes[i]->textureInfo.textureI
d); | 356 m_context->deleteTexture(m_textureMailboxes[i]->textureInfo.textureI
d); |
| 357 m_textureMailboxes[i]->m_parentDrawingBuffer.clear(); |
| 357 m_textureMailboxes.remove(i); | 358 m_textureMailboxes.remove(i); |
| 358 return; | 359 return; |
| 359 } | 360 } |
| 360 } | 361 } |
| 361 ASSERT_NOT_REACHED(); | 362 ASSERT_NOT_REACHED(); |
| 362 } | 363 } |
| 363 | 364 |
| 364 bool DrawingBuffer::initialize(const IntSize& size) | 365 bool DrawingBuffer::initialize(const IntSize& size) |
| 365 { | 366 { |
| 366 if (!m_context->makeContextCurrent()) { | 367 if (!m_context->makeContextCurrent()) { |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1064 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
| 1064 { | 1065 { |
| 1065 if (info->imageId) { | 1066 if (info->imageId) { |
| 1066 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1067 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
| 1067 m_context->destroyImageCHROMIUM(info->imageId); | 1068 m_context->destroyImageCHROMIUM(info->imageId); |
| 1068 info->imageId = 0; | 1069 info->imageId = 0; |
| 1069 } | 1070 } |
| 1070 } | 1071 } |
| 1071 | 1072 |
| 1072 } // namespace WebCore | 1073 } // namespace WebCore |
| OLD | NEW |