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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 } | 974 } |
975 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 975 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
976 | 976 |
977 if (!contextLost) { | 977 if (!contextLost) { |
978 // Invalidate texture state in case the compositor altered it since the | 978 // Invalidate texture state in case the compositor altered it since the |
979 // copy-on-write. | 979 // copy-on-write. |
980 if (releasedMailboxInfo->m_image) { | 980 if (releasedMailboxInfo->m_image) { |
981 #if USE_IOSURFACE_FOR_2D_CANVAS | 981 #if USE_IOSURFACE_FOR_2D_CANVAS |
982 DCHECK(!releasedMailboxInfo->m_imageInfo); | 982 DCHECK(!releasedMailboxInfo->m_imageInfo); |
983 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 983 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
984 if (syncToken.HasData()) { | 984 gpu::gles2::GLES2Interface* gl = contextGL(); |
985 contextGL()->WaitSyncTokenCHROMIUM(syncToken.GetConstData()); | 985 if (syncToken.HasData() && gl) { |
| 986 gl->WaitSyncTokenCHROMIUM(syncToken.GetConstData()); |
986 } | 987 } |
987 GrTexture* texture = releasedMailboxInfo->m_image->getTexture(); | 988 GrTexture* texture = releasedMailboxInfo->m_image->getTexture(); |
988 if (texture) { | 989 if (texture) { |
989 if (lostResource) { | 990 if (lostResource) { |
990 texture->abandon(); | 991 texture->abandon(); |
991 } else { | 992 } else { |
992 texture->textureParamsModified(); | 993 texture->textureParamsModified(); |
993 // Break the mailbox association to avoid leaking mailboxes every time | 994 // Break the mailbox association to avoid leaking mailboxes every time |
994 // skia recycles a texture. | 995 // skia recycles a texture. |
995 gpu::gles2::GLES2Interface* gl = contextGL(); | |
996 if (gl) | 996 if (gl) |
997 gl->ProduceTextureDirectCHROMIUM( | 997 gl->ProduceTextureDirectCHROMIUM( |
998 0, GL_TEXTURE_2D, releasedMailboxInfo->m_mailbox.name); | 998 0, GL_TEXTURE_2D, releasedMailboxInfo->m_mailbox.name); |
999 } | 999 } |
1000 } | 1000 } |
1001 } | 1001 } |
1002 } | 1002 } |
1003 | 1003 |
1004 RefPtr<Canvas2DLayerBridge> selfRef; | 1004 RefPtr<Canvas2DLayerBridge> selfRef; |
1005 if (m_destructionInProgress) { | 1005 if (m_destructionInProgress) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 default; | 1116 default; |
1117 | 1117 |
1118 void Canvas2DLayerBridge::Logger::reportHibernationEvent( | 1118 void Canvas2DLayerBridge::Logger::reportHibernationEvent( |
1119 HibernationEvent event) { | 1119 HibernationEvent event) { |
1120 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, | 1120 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, |
1121 ("Canvas.HibernationEvents", HibernationEventCount)); | 1121 ("Canvas.HibernationEvents", HibernationEventCount)); |
1122 hibernationHistogram.count(event); | 1122 hibernationHistogram.count(event); |
1123 } | 1123 } |
1124 | 1124 |
1125 } // namespace blink | 1125 } // namespace blink |
OLD | NEW |