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

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

Issue 2165913003: Invalidate m_image after GPU-GPU texture copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/StaticBitmapImage.h" 5 #include "platform/graphics/StaticBitmapImage.h"
6 6
7 #include "gpu/command_buffer/client/gles2_interface.h" 7 #include "gpu/command_buffer/client/gles2_interface.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/ImageObserver.h" 9 #include "platform/graphics/ImageObserver.h"
10 #include "public/platform/Platform.h" 10 #include "public/platform/Platform.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 { 106 {
107 GLuint textureId = textureIdForWebGL(provider); 107 GLuint textureId = textureIdForWebGL(provider);
108 gpu::gles2::GLES2Interface* gl = provider->contextGL(); 108 gpu::gles2::GLES2Interface* gl = provider->contextGL();
109 if (!gl) 109 if (!gl)
110 return; 110 return;
111 gl->CopyTextureCHROMIUM(textureId, destinationTexture, internalFormat, destT ype, flipY, false, false); 111 gl->CopyTextureCHROMIUM(textureId, destinationTexture, internalFormat, destT ype, flipY, false, false);
112 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); 112 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM();
113 gl->Flush(); 113 gl->Flush();
114 GLbyte syncToken[24]; 114 GLbyte syncToken[24];
115 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken); 115 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken);
116 m_image = nullptr;
Justin Novosad 2016/07/20 15:07:52 I think a better place for this would be at the en
xidachen 2016/07/20 15:28:24 I don't think that would work. I tried, and what h
Justin Novosad 2016/07/20 15:51:59 Sorry. Here you need to call switchStorageToMailbo
xidachen 2016/07/20 16:47:27 Right, that makes perfect sense, changed in the ne
116 } 117 }
117 118
118 bool StaticBitmapImage::switchStorageToMailbox(WebGraphicsContext3DProvider* pro vider) 119 bool StaticBitmapImage::switchStorageToMailbox(WebGraphicsContext3DProvider* pro vider)
119 { 120 {
120 m_mailbox.textureSize = WebSize(m_image->width(), m_image->height()); 121 m_mailbox.textureSize = WebSize(m_image->width(), m_image->height());
121 GrContext* grContext = provider->grContext(); 122 GrContext* grContext = provider->grContext();
122 if (!grContext) 123 if (!grContext)
123 return false; 124 return false;
124 grContext->flush(); 125 grContext->flush();
125 m_mailbox.textureTarget = GL_TEXTURE_2D; 126 m_mailbox.textureTarget = GL_TEXTURE_2D;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // Has mailbox, consume mailbox, prepare a new mailbox if contextProvider is not null (3D). 176 // Has mailbox, consume mailbox, prepare a new mailbox if contextProvider is not null (3D).
176 DCHECK(isMainThread()); 177 DCHECK(isMainThread());
177 // TODO(xidachen): make this work on a worker thread. 178 // TODO(xidachen): make this work on a worker thread.
178 std::unique_ptr<WebGraphicsContext3DProvider> sharedProvider = wrapUnique(Pl atform::current()->createSharedOffscreenGraphicsContext3DProvider()); 179 std::unique_ptr<WebGraphicsContext3DProvider> sharedProvider = wrapUnique(Pl atform::current()->createSharedOffscreenGraphicsContext3DProvider());
179 if (!switchStorageToSkImage(sharedProvider.get())) 180 if (!switchStorageToSkImage(sharedProvider.get()))
180 return nullptr; 181 return nullptr;
181 return m_image; 182 return m_image;
182 } 183 }
183 184
184 } // namespace blink 185 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698