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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: Created 4 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SkiaTextureHolder_h
6 #define SkiaTextureHolder_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/TextureHolder.h"
10
11 namespace blink {
12
13 class MailboxTextureHolder;
14
15 class PLATFORM_EXPORT SkiaTextureHolder final : public TextureHolder {
16 public:
17 bool isSkiaTextureHolder() final { return true; }
18 unsigned sharedContextId() final;
19 gpu::Mailbox getMailbox() final { return gpu::Mailbox(); }
20 gpu::SyncToken getSyncToken() final { return gpu::SyncToken(); }
21 IntSize getMailboxSize() final { return IntSize(); }
22 void releaseImageThreadSafe() final;
23 sk_sp<SkImage> getSkImage() final { return m_image; }
24 WebThread* getImageThread() final { return m_imageThread; }
25 IntSize size() const final {
26 return IntSize(m_image->width(), m_image->height());
27 }
28 void setSharedContextId(unsigned contextId) final {
29 m_sharedContextId = contextId;
30 }
31 void setImageThread(WebThread* thread) { m_imageThread = thread; }
32 void deleteTexture(const int8_t* syncTokenData) final {}
33
34 // When creating a AcceleratedStaticBitmap from a texture-backed SkImage, this
35 // function will be called to create a TextureHolder object.
36 SkiaTextureHolder(sk_sp<SkImage>);
37 // This function consumes the mailbox in the input parameter and turn it into
38 // a texture-backed SkImage.
39 SkiaTextureHolder(const gpu::Mailbox&,
40 const gpu::SyncToken&,
41 IntSize mailboxSize);
42
43 private:
44 // The m_image should always be texture-backed
45 sk_sp<SkImage> m_image;
46 // Id of the shared context where m_image was created
47 unsigned m_sharedContextId = 0;
48 // Thread that |m_image| belongs to. Set to null when |m_image| belongs to the
49 // same thread as the AcceleratedStaticBitmapImage. Should only be non-null
50 // after a transfer.
51 WebThread* m_imageThread = nullptr;
52 };
53
54 } // namespace blink
55
56 #endif // SkiaTextureHolder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698