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

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

Issue 2521013003: Compositing Layer update for OffscreenCanvas resize (Closed)
Patch Set: test 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
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/output/begin_frame_args.h" 9 #include "cc/output/begin_frame_args.h"
10 #include "cc/resources/shared_bitmap.h" 10 #include "cc/resources/shared_bitmap.h"
11 #include "cc/surfaces/surface_id.h" 11 #include "cc/surfaces/surface_id.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" 13 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h"
14 #include "platform/graphics/StaticBitmapImage.h" 14 #include "platform/graphics/StaticBitmapImage.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 OffscreenCanvasFrameDispatcherImpl(uint32_t clientId, 24 OffscreenCanvasFrameDispatcherImpl(uint32_t clientId,
25 uint32_t sinkId, 25 uint32_t sinkId,
26 uint32_t localId, 26 uint32_t localId,
27 uint64_t nonceHigh, 27 uint64_t nonceHigh,
28 uint64_t nonceLow, 28 uint64_t nonceLow,
29 int canvasId, 29 int canvasId,
30 int width, 30 unsigned width,
31 int height); 31 unsigned height);
32 32
33 // OffscreenCanvasFrameDispatcher implementation. 33 // OffscreenCanvasFrameDispatcher implementation.
34 ~OffscreenCanvasFrameDispatcherImpl() override {} 34 ~OffscreenCanvasFrameDispatcherImpl() override {}
35 void dispatchFrame(RefPtr<StaticBitmapImage>, 35 void dispatchFrame(RefPtr<StaticBitmapImage>,
36 double commitStartTime, 36 double commitStartTime,
37 bool isWebGLSoftwareRendering = false) override; 37 bool isWebGLSoftwareRendering = false) override;
38 void reclaimResource(unsigned resourceId) override; 38 void reclaimResource(unsigned resourceId) override;
39 39
40 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. 40 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation.
41 void DidReceiveCompositorFrameAck() override; 41 void DidReceiveCompositorFrameAck() override;
42 void OnBeginFrame(const cc::BeginFrameArgs&) override; 42 void OnBeginFrame(const cc::BeginFrameArgs&) override;
43 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 43 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
44 44
45 // This enum is used in histogram, so it should be append-only. 45 // This enum is used in histogram, so it should be append-only.
46 enum OffscreenCanvasCommitType { 46 enum OffscreenCanvasCommitType {
47 CommitGPUCanvasGPUCompositing = 0, 47 CommitGPUCanvasGPUCompositing = 0,
48 CommitGPUCanvasSoftwareCompositing = 1, 48 CommitGPUCanvasSoftwareCompositing = 1,
49 CommitSoftwareCanvasGPUCompositing = 2, 49 CommitSoftwareCanvasGPUCompositing = 2,
50 CommitSoftwareCanvasSoftwareCompositing = 3, 50 CommitSoftwareCanvasSoftwareCompositing = 3,
51 OffscreenCanvasCommitTypeCount, 51 OffscreenCanvasCommitTypeCount,
52 }; 52 };
53 53
54 void reshape(unsigned width, unsigned height) override;
55
54 private: 56 private:
55 const cc::SurfaceId m_surfaceId; 57 const cc::FrameSinkId m_frameSinkId;
56 const int m_width; 58 int m_width;
57 const int m_height; 59 int m_height;
58 60
59 unsigned m_nextResourceId; 61 unsigned m_nextResourceId;
60 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; 62 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages;
61 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps; 63 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps;
62 HashMap<unsigned, GLuint> m_cachedTextureIds; 64 HashMap<unsigned, GLuint> m_cachedTextureIds;
63 HashSet<unsigned> m_spareResourceLocks; 65 HashSet<unsigned> m_spareResourceLocks;
64 66
65 bool verifyImageSize(const IntSize); 67 bool verifyImageSize(const IntSize);
66 68
67 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink; 69 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink;
68 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding; 70 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding;
69 71
70 int m_placeholderCanvasId; 72 int m_placeholderCanvasId;
71 73
72 void setTransferableResourceToSharedBitmap(cc::TransferableResource&, 74 void setTransferableResourceToSharedBitmap(cc::TransferableResource&,
73 RefPtr<StaticBitmapImage>); 75 RefPtr<StaticBitmapImage>);
74 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&, 76 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&,
75 RefPtr<StaticBitmapImage>); 77 RefPtr<StaticBitmapImage>);
76 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&, 78 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&,
77 RefPtr<StaticBitmapImage>); 79 RefPtr<StaticBitmapImage>);
78 }; 80 };
79 81
80 } // namespace blink 82 } // namespace blink
81 83
82 #endif // OffscreenCanvasFrameDispatcherImpl_h 84 #endif // OffscreenCanvasFrameDispatcherImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698