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

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

Issue 2360413002: Implement OffscreenCanvas Unaccelerated 2d commit() on main thread (Closed)
Patch Set: fix Created 4 years, 2 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
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;
37 unsigned getNextResourceIdAndIncrement() { return m_nextResourceId++; }
36 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; 38 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages;
39 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps;
37 40
38 bool verifyImageSize(const sk_sp<SkImage>&); 41 bool verifyImageSize(const sk_sp<SkImage>&);
39 42
40 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink; 43 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink;
41 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding; 44 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding;
42 }; 45 };
43 46
44 } // namespace blink 47 } // namespace blink
45 48
46 #endif // OffscreenCanvasFrameDispatcherImpl_h 49 #endif // OffscreenCanvasFrameDispatcherImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698