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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 ensureMailbox(); | 148 ensureMailbox(); |
149 // If |m_textureThreadTaskRunner| in TextureHolder is set, it means that | 149 // If |m_textureThreadTaskRunner| in TextureHolder is set, it means that |
150 // the |m_texture| in this class has been consumed on the current thread, | 150 // the |m_texture| in this class has been consumed on the current thread, |
151 // which may happen when we have chained transfers. When that is the case, | 151 // which may happen when we have chained transfers. When that is the case, |
152 // we must not reset |m_imageThreadTaskRunner|, so we ensure that | 152 // we must not reset |m_imageThreadTaskRunner|, so we ensure that |
153 // releaseImage() or releaseTexture() is called on the right thread. | 153 // releaseImage() or releaseTexture() is called on the right thread. |
154 if (!m_textureHolder->wasTransferred()) { | 154 if (!m_textureHolder->wasTransferred()) { |
155 WebThread* currentThread = Platform::current()->currentThread(); | 155 WebThread* currentThread = Platform::current()->currentThread(); |
156 m_textureHolder->setWasTransferred(true); | 156 m_textureHolder->setWasTransferred(true); |
157 m_textureHolder->setTextureThreadTaskRunner( | 157 m_textureHolder->setTextureThreadTaskRunner( |
158 currentThread->getWebTaskRunner()->clone()); | 158 currentThread->getWebTaskRunner()); |
159 } | 159 } |
160 m_detachThreadAtNextCheck = true; | 160 m_detachThreadAtNextCheck = true; |
161 } | 161 } |
162 | 162 |
163 bool AcceleratedStaticBitmapImage::currentFrameKnownToBeOpaque( | 163 bool AcceleratedStaticBitmapImage::currentFrameKnownToBeOpaque( |
164 MetadataMode metadataMode) { | 164 MetadataMode metadataMode) { |
165 return m_textureHolder->currentFrameKnownToBeOpaque(metadataMode); | 165 return m_textureHolder->currentFrameKnownToBeOpaque(metadataMode); |
166 } | 166 } |
167 | 167 |
168 void AcceleratedStaticBitmapImage::checkThread() { | 168 void AcceleratedStaticBitmapImage::checkThread() { |
169 if (m_detachThreadAtNextCheck) { | 169 if (m_detachThreadAtNextCheck) { |
170 m_threadChecker.DetachFromThread(); | 170 m_threadChecker.DetachFromThread(); |
171 m_detachThreadAtNextCheck = false; | 171 m_detachThreadAtNextCheck = false; |
172 } | 172 } |
173 CHECK(m_threadChecker.CalledOnValidThread()); | 173 CHECK(m_threadChecker.CalledOnValidThread()); |
174 } | 174 } |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
OLD | NEW |