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

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

Issue 2738573002: Streamline the presentation of ImageBitmapRenderingContext (Closed)
Patch Set: Fixed expectations Created 3 years, 8 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
(Empty)
1 // Copyright 2017 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 ImageLayerBridge_h
6 #define ImageLayerBridge_h
7
8 #include "cc/layers/texture_layer_client.h"
9 #include "platform/PlatformExport.h"
10 #include "platform/graphics/StaticBitmapImage.h"
11 #include "platform/heap/Heap.h"
12 #include "wtf/WeakPtr.h"
13
14 namespace cc {
15 class SharedBitmap;
16 }
17
18 namespace blink {
19
20 class WebLayer;
21 class WebExternalTextureLayer;
22
23 class PLATFORM_EXPORT ImageLayerBridge
24 : public GarbageCollectedFinalized<ImageLayerBridge>,
25 NON_EXPORTED_BASE(public cc::TextureLayerClient) {
26 WTF_MAKE_NONCOPYABLE(ImageLayerBridge);
27
28 public:
29 ImageLayerBridge(OpacityMode);
30 ~ImageLayerBridge();
31
32 void setImage(PassRefPtr<StaticBitmapImage>);
33 void dispose();
34
35 // cc::TextureLayerClient implementation.
36 bool PrepareTextureMailbox(
37 cc::TextureMailbox* outMailbox,
38 std::unique_ptr<cc::SingleReleaseCallback>* outReleaseCallback) override;
39
40 void mailboxReleasedGpu(RefPtr<StaticBitmapImage>,
41 const gpu::SyncToken&,
42 bool lostResource);
43
44 void mailboxReleasedSoftware(std::unique_ptr<cc::SharedBitmap>,
45 const IntSize&,
46 const gpu::SyncToken&,
47 bool lostResource);
48
49 RefPtr<StaticBitmapImage> image() { return m_image; }
50
51 WebLayer* platformLayer() const;
52
53 void setFilterQuality(SkFilterQuality filterQuality) {
54 m_filterQuality = filterQuality;
55 }
56
57 bool isAccelerated() { return m_image->isTextureBacked(); }
58
59 DEFINE_INLINE_TRACE() {}
60
61 private:
62 std::unique_ptr<cc::SharedBitmap> createOrRecycleBitmap();
63
64 WeakPtrFactory<ImageLayerBridge> m_weakPtrFactory;
65 RefPtr<StaticBitmapImage> m_image;
66 std::unique_ptr<WebExternalTextureLayer> m_layer;
67 SkFilterQuality m_filterQuality = kLow_SkFilterQuality;
68
69 // Shared memory bitmaps that were released by the compositor and can be used
70 // again by this ImageLayerBridge.
71 struct RecycledBitmap {
72 std::unique_ptr<cc::SharedBitmap> bitmap;
73 IntSize size;
74 };
75 Vector<RecycledBitmap> m_recycledBitmaps;
76
77 bool m_disposed = false;
78 bool m_hasPresentedSinceLastSetImage = false;
79 OpacityMode m_opacityMode = NonOpaque;
80 };
81
82 } // namespace blink
83
84 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698