| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 } | 967 } |
| 968 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 968 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 969 | 969 |
| 970 if (!contextLost) { | 970 if (!contextLost) { |
| 971 // Invalidate texture state in case the compositor altered it since the | 971 // Invalidate texture state in case the compositor altered it since the |
| 972 // copy-on-write. | 972 // copy-on-write. |
| 973 if (releasedMailboxInfo->m_image) { | 973 if (releasedMailboxInfo->m_image) { |
| 974 #if USE_IOSURFACE_FOR_2D_CANVAS | 974 #if USE_IOSURFACE_FOR_2D_CANVAS |
| 975 DCHECK(!releasedMailboxInfo->m_imageInfo); | 975 DCHECK(!releasedMailboxInfo->m_imageInfo); |
| 976 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 976 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 977 if (syncToken.HasData()) { | 977 gpu::gles2::GLES2Interface* gl = contextGL(); |
| 978 contextGL()->WaitSyncTokenCHROMIUM(syncToken.GetConstData()); | 978 if (syncToken.HasData() && gl) { |
| 979 gl->WaitSyncTokenCHROMIUM(syncToken.GetConstData()); |
| 979 } | 980 } |
| 980 GrTexture* texture = releasedMailboxInfo->m_image->getTexture(); | 981 GrTexture* texture = releasedMailboxInfo->m_image->getTexture(); |
| 981 if (texture) { | 982 if (texture) { |
| 982 if (lostResource) { | 983 if (lostResource) { |
| 983 texture->abandon(); | 984 texture->abandon(); |
| 984 } else { | 985 } else { |
| 985 texture->textureParamsModified(); | 986 texture->textureParamsModified(); |
| 986 // Break the mailbox association to avoid leaking mailboxes every time | 987 // Break the mailbox association to avoid leaking mailboxes every time |
| 987 // skia recycles a texture. | 988 // skia recycles a texture. |
| 988 gpu::gles2::GLES2Interface* gl = contextGL(); | |
| 989 if (gl) | 989 if (gl) |
| 990 gl->ProduceTextureDirectCHROMIUM( | 990 gl->ProduceTextureDirectCHROMIUM( |
| 991 0, GL_TEXTURE_2D, releasedMailboxInfo->m_mailbox.name); | 991 0, GL_TEXTURE_2D, releasedMailboxInfo->m_mailbox.name); |
| 992 } | 992 } |
| 993 } | 993 } |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 | 996 |
| 997 RefPtr<Canvas2DLayerBridge> selfRef; | 997 RefPtr<Canvas2DLayerBridge> selfRef; |
| 998 if (m_destructionInProgress) { | 998 if (m_destructionInProgress) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 default; | 1109 default; |
| 1110 | 1110 |
| 1111 void Canvas2DLayerBridge::Logger::reportHibernationEvent( | 1111 void Canvas2DLayerBridge::Logger::reportHibernationEvent( |
| 1112 HibernationEvent event) { | 1112 HibernationEvent event) { |
| 1113 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, | 1113 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, |
| 1114 ("Canvas.HibernationEvents", HibernationEventCount)); | 1114 ("Canvas.HibernationEvents", HibernationEventCount)); |
| 1115 hibernationHistogram.count(event); | 1115 hibernationHistogram.count(event); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 } // namespace blink | 1118 } // namespace blink |
| OLD | NEW |