| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/graphics/AcceleratedStaticBitmapImage.h" | 5 #include "platform/graphics/AcceleratedStaticBitmapImage.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" |
| 8 #include "gpu/command_buffer/common/sync_token.h" | 8 #include "gpu/command_buffer/common/sync_token.h" |
| 9 #include "platform/graphics/MailboxTextureHolder.h" | 9 #include "platform/graphics/MailboxTextureHolder.h" |
| 10 #include "platform/graphics/SkiaTextureHolder.h" | 10 #include "platform/graphics/SkiaTextureHolder.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM( | 83 GLuint sourceTextureId = destGL->CreateAndConsumeTextureCHROMIUM( |
| 84 GL_TEXTURE_2D, m_textureHolder->mailbox().name); | 84 GL_TEXTURE_2D, m_textureHolder->mailbox().name); |
| 85 destGL->CopyTextureCHROMIUM(sourceTextureId, 0, GL_TEXTURE_2D, destTextureId, | 85 destGL->CopyTextureCHROMIUM(sourceTextureId, 0, GL_TEXTURE_2D, destTextureId, |
| 86 0, internalFormat, destType, flipY, false, false); | 86 0, internalFormat, destType, flipY, false, false); |
| 87 // This drops the |destGL| context's reference on our |m_mailbox|, but it's | 87 // This drops the |destGL| context's reference on our |m_mailbox|, but it's |
| 88 // still held alive by our SkImage. | 88 // still held alive by our SkImage. |
| 89 destGL->DeleteTextures(1, &sourceTextureId); | 89 destGL->DeleteTextures(1, &sourceTextureId); |
| 90 } | 90 } |
| 91 | 91 |
| 92 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { | 92 sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { |
| 93 // TODO(xlai): Refactor so that sync tokens are only used when | |
| 94 // |m_textureHolder| is MailboxTextureHolder. | |
| 95 // https://crbug.com/693229 | |
| 96 checkThread(); | 93 checkThread(); |
| 97 if (!isValid()) | 94 if (!isValid()) |
| 98 return nullptr; | 95 return nullptr; |
| 99 createImageFromMailboxIfNeeded(); | 96 createImageFromMailboxIfNeeded(); |
| 100 return m_textureHolder->skImage(); | 97 return m_textureHolder->skImage(); |
| 101 } | 98 } |
| 102 | 99 |
| 103 void AcceleratedStaticBitmapImage::draw(PaintCanvas* canvas, | 100 void AcceleratedStaticBitmapImage::draw(PaintCanvas* canvas, |
| 104 const PaintFlags& flags, | 101 const PaintFlags& flags, |
| 105 const FloatRect& dstRect, | 102 const FloatRect& dstRect, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 169 |
| 173 void AcceleratedStaticBitmapImage::checkThread() { | 170 void AcceleratedStaticBitmapImage::checkThread() { |
| 174 if (m_detachThreadAtNextCheck) { | 171 if (m_detachThreadAtNextCheck) { |
| 175 m_threadChecker.DetachFromThread(); | 172 m_threadChecker.DetachFromThread(); |
| 176 m_detachThreadAtNextCheck = false; | 173 m_detachThreadAtNextCheck = false; |
| 177 } | 174 } |
| 178 CHECK(m_threadChecker.CalledOnValidThread()); | 175 CHECK(m_threadChecker.CalledOnValidThread()); |
| 179 } | 176 } |
| 180 | 177 |
| 181 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |