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

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

Issue 2455983005: Refactor AcceleratedStaticBitmapImage (Closed)
Patch Set: minor clean up 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 PLATFORM_EXPORT SkiaTextureHolder final : public TextureHolder {
14 public:
15 ~SkiaTextureHolder() override;
16
17 bool isSkiaTextureHolder() final { return true; }
18 bool isMailboxTextureHolder() final { return false; }
19 unsigned sharedContextId() final;
20 WebThread* imageThread() final { return m_imageThread; }
21 IntSize size() const final {
22 return IntSize(m_image->width(), m_image->height());
23 }
24
25 sk_sp<SkImage> skImage() final { return m_image; }
26 void setSharedContextId(unsigned contextId) final {
27 m_sharedContextId = contextId;
28 }
29 void setImageThread(WebThread* thread) { m_imageThread = thread; }
Justin Novosad 2016/11/03 17:37:47 this is probably not safe. I though you were going
xidachen 2016/11/03 20:03:10 Done.
30
31 // When creating a AcceleratedStaticBitmap from a texture-backed SkImage, this
32 // function will be called to create a TextureHolder object.
33 SkiaTextureHolder(sk_sp<SkImage>);
34 // This function consumes the mailbox in the input parameter and turn it into
35 // a texture-backed SkImage.
36 SkiaTextureHolder(std::unique_ptr<TextureHolder>);
37
38 private:
39 void releaseImageThreadSafe();
40
41 // The m_image should always be texture-backed
42 sk_sp<SkImage> m_image;
43 // Id of the shared context where m_image was created
44 unsigned m_sharedContextId = 0;
45 // Thread that |m_image| belongs to. Set to null when |m_image| belongs to the
46 // same thread as the AcceleratedStaticBitmapImage. Should only be non-null
47 // after a transfer.
48 WebThread* m_imageThread = nullptr;
49 };
50
51 } // namespace blink
52
53 #endif // SkiaTextureHolder_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698