Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp

Issue 2550373005: Make WebTaskRunner ThreadSafeRefCounted (Closed)
Patch Set: +DISALLOW_COPY_AND_ASSIGN for win build fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ensureMailbox(); 154 ensureMailbox();
155 // If |m_textureThreadTaskRunner| in TextureHolder is set, it means that 155 // If |m_textureThreadTaskRunner| in TextureHolder is set, it means that
156 // the |m_texture| in this class has been consumed on the current thread, 156 // the |m_texture| in this class has been consumed on the current thread,
157 // which may happen when we have chained transfers. When that is the case, 157 // which may happen when we have chained transfers. When that is the case,
158 // we must not reset |m_imageThreadTaskRunner|, so we ensure that 158 // we must not reset |m_imageThreadTaskRunner|, so we ensure that
159 // releaseImage() or releaseTexture() is called on the right thread. 159 // releaseImage() or releaseTexture() is called on the right thread.
160 if (!m_textureHolder->wasTransferred()) { 160 if (!m_textureHolder->wasTransferred()) {
161 WebThread* currentThread = Platform::current()->currentThread(); 161 WebThread* currentThread = Platform::current()->currentThread();
162 m_textureHolder->setWasTransferred(true); 162 m_textureHolder->setWasTransferred(true);
163 m_textureHolder->setTextureThreadTaskRunner( 163 m_textureHolder->setTextureThreadTaskRunner(
164 currentThread->getWebTaskRunner()->clone()); 164 currentThread->getWebTaskRunner());
165 } 165 }
166 m_detachThreadAtNextCheck = true; 166 m_detachThreadAtNextCheck = true;
167 } 167 }
168 168
169 bool AcceleratedStaticBitmapImage::currentFrameKnownToBeOpaque( 169 bool AcceleratedStaticBitmapImage::currentFrameKnownToBeOpaque(
170 MetadataMode metadataMode) { 170 MetadataMode metadataMode) {
171 return m_textureHolder->currentFrameKnownToBeOpaque(metadataMode); 171 return m_textureHolder->currentFrameKnownToBeOpaque(metadataMode);
172 } 172 }
173 173
174 void AcceleratedStaticBitmapImage::checkThread() { 174 void AcceleratedStaticBitmapImage::checkThread() {
175 if (m_detachThreadAtNextCheck) { 175 if (m_detachThreadAtNextCheck) {
176 m_threadChecker.DetachFromThread(); 176 m_threadChecker.DetachFromThread();
177 m_detachThreadAtNextCheck = false; 177 m_detachThreadAtNextCheck = false;
178 } 178 }
179 CHECK(m_threadChecker.CalledOnValidThread()); 179 CHECK(m_threadChecker.CalledOnValidThread());
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698