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 #ifndef OffscreenCanvasFrameDispatcherImpl_h | 5 #ifndef OffscreenCanvasFrameDispatcherImpl_h |
6 #define OffscreenCanvasFrameDispatcherImpl_h | 6 #define OffscreenCanvasFrameDispatcherImpl_h |
7 | 7 |
8 #include "cc/ipc/mojo_compositor_frame_sink.mojom-blink.h" | 8 #include "cc/ipc/mojo_compositor_frame_sink.mojom-blink.h" |
| 9 #include "cc/resources/shared_bitmap.h" |
9 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 11 #include "mojo/public/cpp/bindings/binding.h" |
11 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" | 12 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" |
12 #include "platform/graphics/StaticBitmapImage.h" | 13 #include "platform/graphics/StaticBitmapImage.h" |
13 #include "wtf/Compiler.h" | 14 #include "wtf/Compiler.h" |
14 #include <memory> | 15 #include <memory> |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcherImpl final : public Offscree
nCanvasFrameDispatcher | 19 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcherImpl final : public Offscree
nCanvasFrameDispatcher |
19 , WTF_NON_EXPORTED_BASE(public cc::mojom::blink::MojoCompositorFrameSinkClie
nt) { | 20 , WTF_NON_EXPORTED_BASE(public cc::mojom::blink::MojoCompositorFrameSinkClie
nt) { |
20 public: | 21 public: |
21 explicit OffscreenCanvasFrameDispatcherImpl(uint32_t clientId, uint32_t loca
lId, uint64_t nonce, int width, int height); | 22 explicit OffscreenCanvasFrameDispatcherImpl(uint32_t clientId, uint32_t loca
lId, uint64_t nonce, int width, int height); |
22 | 23 |
23 // OffscreenCanvasFrameDispatcher implementation. | 24 // OffscreenCanvasFrameDispatcher implementation. |
24 ~OffscreenCanvasFrameDispatcherImpl() override {} | 25 ~OffscreenCanvasFrameDispatcherImpl() override {} |
25 void dispatchFrame(RefPtr<StaticBitmapImage>) override; | 26 void dispatchFrame(RefPtr<StaticBitmapImage>) override; |
26 | 27 |
27 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. | 28 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. |
28 void ReturnResources(Vector<cc::mojom::blink::ReturnedResourcePtr> resources
) override; | 29 void ReturnResources(Vector<cc::mojom::blink::ReturnedResourcePtr> resources
) override; |
29 | 30 |
30 private: | 31 private: |
31 const cc::SurfaceId m_surfaceId; | 32 const cc::SurfaceId m_surfaceId; |
32 const int m_width; | 33 const int m_width; |
33 const int m_height; | 34 const int m_height; |
34 | 35 |
35 unsigned m_nextResourceId; | 36 unsigned m_nextResourceId; |
36 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; | 37 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; |
| 38 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps; |
37 | 39 |
38 bool verifyImageSize(const sk_sp<SkImage>&); | 40 bool verifyImageSize(const sk_sp<SkImage>&); |
39 | 41 |
40 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink; | 42 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink; |
41 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding; | 43 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding; |
42 }; | 44 }; |
43 | 45 |
44 } // namespace blink | 46 } // namespace blink |
45 | 47 |
46 #endif // OffscreenCanvasFrameDispatcherImpl_h | 48 #endif // OffscreenCanvasFrameDispatcherImpl_h |
OLD | NEW |