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/CrossThreadFunctional.h" | 9 #include "platform/CrossThreadFunctional.h" |
10 #include "platform/graphics/StaticBitmapImage.h" | 10 #include "platform/graphics/StaticBitmapImage.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include <memory> | 21 #include <memory> |
22 #include <utility> | 22 #include <utility> |
23 | 23 |
24 namespace blink { | 24 namespace blink { |
25 | 25 |
26 PassRefPtr<AcceleratedStaticBitmapImage> AcceleratedStaticBitmapImage::createFro mSharedContextImage(sk_sp<SkImage> image) | 26 PassRefPtr<AcceleratedStaticBitmapImage> AcceleratedStaticBitmapImage::createFro mSharedContextImage(sk_sp<SkImage> image) |
27 { | 27 { |
28 return adoptRef(new AcceleratedStaticBitmapImage(std::move(image))); | 28 return adoptRef(new AcceleratedStaticBitmapImage(std::move(image))); |
29 } | 29 } |
30 | 30 |
31 PassRefPtr<AcceleratedStaticBitmapImage> AcceleratedStaticBitmapImage::createFro mWebGLContextImage(sk_sp<SkImage> image, const gpu::Mailbox& mailbox, const gpu: :SyncToken& syncToken) | 31 PassRefPtr<AcceleratedStaticBitmapImage> AcceleratedStaticBitmapImage::createFro mWebGLContextImage(sk_sp<SkImage> image, const gpu::Mailbox& mailbox, const gpu: :SyncToken& syncToken, GLuint textureId) |
danakj
2016/09/09 20:51:42
"textureId" for what? Can you make this name expla
| |
32 { | 32 { |
33 return adoptRef(new AcceleratedStaticBitmapImage(std::move(image), mailbox, syncToken)); | 33 return adoptRef(new AcceleratedStaticBitmapImage(std::move(image), mailbox, syncToken, textureId)); |
34 } | 34 } |
35 | 35 |
36 AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage(sk_sp<SkImage> image) | 36 AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage(sk_sp<SkImage> image) |
37 : StaticBitmapImage(std::move(image)) | 37 : StaticBitmapImage(std::move(image)) |
38 , m_sharedContextId(SharedGpuContext::contextId()) | 38 , m_sharedContextId(SharedGpuContext::contextId()) |
39 { | 39 { |
40 m_threadChecker.DetachFromThread(); | 40 m_threadChecker.DetachFromThread(); |
41 } | 41 } |
42 | 42 |
43 AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage(sk_sp<SkImage> image, const gpu::Mailbox& mailbox, const gpu::SyncToken& syncToken) | 43 AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage(sk_sp<SkImage> image, const gpu::Mailbox& mailbox, const gpu::SyncToken& syncToken, GLuint textureId) |
44 : StaticBitmapImage(std::move(image)) | 44 : StaticBitmapImage(std::move(image)) |
45 , m_sharedContextId(SharedGpuContext::kNoSharedContext) | 45 , m_sharedContextId(SharedGpuContext::kNoSharedContext) |
46 , m_hasMailbox(true) | 46 , m_hasMailbox(true) |
47 , m_mailbox(mailbox) | 47 , m_mailbox(mailbox) |
48 , m_syncToken(syncToken) | 48 , m_syncToken(syncToken) |
49 , m_textureId(textureId) | |
49 { | 50 { |
50 m_threadChecker.DetachFromThread(); | 51 m_threadChecker.DetachFromThread(); |
51 | 52 |
52 // Note: In this case, m_image is not usable directly because it is not in t he shared context. | 53 // Note: In this case, m_image is not usable directly because it is not in t he shared context. |
53 // It is just used to hold a reference to the texture object in the origin c ontext until the | 54 // It is just used to hold a reference to the texture object in the origin c ontext until the |
54 // mailbox can be consumed. | 55 // mailbox can be consumed. |
55 } | 56 } |
56 | 57 |
57 AcceleratedStaticBitmapImage::~AcceleratedStaticBitmapImage() | 58 AcceleratedStaticBitmapImage::~AcceleratedStaticBitmapImage() |
58 { | 59 { |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 const GLuint64 fenceSync = sharedGL->InsertFenceSyncCHROMIUM(); | 209 const GLuint64 fenceSync = sharedGL->InsertFenceSyncCHROMIUM(); |
209 sharedGL->Flush(); | 210 sharedGL->Flush(); |
210 sharedGL->GenSyncTokenCHROMIUM(fenceSync, releaseSyncToken->GetData()); | 211 sharedGL->GenSyncTokenCHROMIUM(fenceSync, releaseSyncToken->GetData()); |
211 m_imageThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, crossThread Bind(&releaseImage, passed(std::move(m_image)), passed(std::move(releaseSyncToke n)))); | 212 m_imageThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, crossThread Bind(&releaseImage, passed(std::move(m_image)), passed(std::move(releaseSyncToke n)))); |
212 } | 213 } |
213 m_image = nullptr; | 214 m_image = nullptr; |
214 m_imageThread = nullptr; | 215 m_imageThread = nullptr; |
215 } | 216 } |
216 | 217 |
217 } // namespace blink | 218 } // namespace blink |
OLD | NEW |