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