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

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

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)
Patch Set: rebase again Created 3 years, 10 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/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"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 OffscreenCanvasFrameDispatcherImpl(OffscreenCanvasFrameDispatcherClient*, 26 OffscreenCanvasFrameDispatcherImpl(OffscreenCanvasFrameDispatcherClient*,
27 uint32_t clientId, 27 uint32_t clientId,
28 uint32_t sinkId, 28 uint32_t sinkId,
29 int canvasId, 29 int canvasId,
30 int width, 30 int width,
31 int height); 31 int height);
32 32
33 // OffscreenCanvasFrameDispatcher implementation. 33 // OffscreenCanvasFrameDispatcher implementation.
34 ~OffscreenCanvasFrameDispatcherImpl() final; 34 ~OffscreenCanvasFrameDispatcherImpl() final;
35 void setNeedsBeginFrame(bool) final;
35 void dispatchFrame(RefPtr<StaticBitmapImage>, 36 void dispatchFrame(RefPtr<StaticBitmapImage>,
36 double commitStartTime, 37 double commitStartTime,
37 bool isWebGLSoftwareRendering = false) final; 38 bool isWebGLSoftwareRendering = false) final;
38 void reclaimResource(unsigned resourceId) final; 39 void reclaimResource(unsigned resourceId) final;
39 void reshape(int width, int height) final; 40 void reshape(int width, int height) final;
40 41
41 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. 42 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation.
42 void DidReceiveCompositorFrameAck() final; 43 void DidReceiveCompositorFrameAck() final;
43 void OnBeginFrame(const cc::BeginFrameArgs&) final; 44 void OnBeginFrame(const cc::BeginFrameArgs&) final;
44 void ReclaimResources(const cc::ReturnedResourceArray& resources) final; 45 void ReclaimResources(const cc::ReturnedResourceArray& resources) final;
45 void WillDrawSurface() final; 46 void WillDrawSurface() final;
46 47
47 // This enum is used in histogram, so it should be append-only. 48 // This enum is used in histogram, so it should be append-only.
48 enum OffscreenCanvasCommitType { 49 enum OffscreenCanvasCommitType {
49 CommitGPUCanvasGPUCompositing = 0, 50 CommitGPUCanvasGPUCompositing = 0,
50 CommitGPUCanvasSoftwareCompositing = 1, 51 CommitGPUCanvasSoftwareCompositing = 1,
51 CommitSoftwareCanvasGPUCompositing = 2, 52 CommitSoftwareCanvasGPUCompositing = 2,
52 CommitSoftwareCanvasSoftwareCompositing = 3, 53 CommitSoftwareCanvasSoftwareCompositing = 3,
53 OffscreenCanvasCommitTypeCount, 54 OffscreenCanvasCommitTypeCount,
54 }; 55 };
55 56
56 private: 57 private:
57 // Surface-related 58 // Surface-related
58 cc::SurfaceIdAllocator m_surfaceIdAllocator; 59 cc::SurfaceIdAllocator m_surfaceIdAllocator;
59 void scheduleSyntheticBeginFrame(); // To be removed (crbug.com/674744)
60
61 TaskHandle m_syntheticBeginFrameTask; // To be removed (crbug.com/674744)
62 const cc::FrameSinkId m_frameSinkId; 60 const cc::FrameSinkId m_frameSinkId;
63 cc::LocalSurfaceId m_currentLocalSurfaceId; 61 cc::LocalSurfaceId m_currentLocalSurfaceId;
64 62
65 int m_width; 63 int m_width;
66 int m_height; 64 int m_height;
67 bool m_changeSizeForNextCommit; 65 bool m_changeSizeForNextCommit;
66 bool m_needsBeginFrame;
68 67
69 unsigned m_nextResourceId; 68 unsigned m_nextResourceId;
70 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; 69 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages;
71 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps; 70 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps;
72 HashMap<unsigned, GLuint> m_cachedTextureIds; 71 HashMap<unsigned, GLuint> m_cachedTextureIds;
73 HashSet<unsigned> m_spareResourceLocks; 72 HashSet<unsigned> m_spareResourceLocks;
74 73
75 bool verifyImageSize(const IntSize); 74 bool verifyImageSize(const IntSize);
75 void postImageToPlaceholder(RefPtr<StaticBitmapImage>);
76 76
77 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink; 77 cc::mojom::blink::MojoCompositorFrameSinkPtr m_sink;
78 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding; 78 mojo::Binding<cc::mojom::blink::MojoCompositorFrameSinkClient> m_binding;
79 79
80 int m_placeholderCanvasId; 80 int m_placeholderCanvasId;
81 81
82 void setTransferableResourceToSharedBitmap(cc::TransferableResource&, 82 void setTransferableResourceToSharedBitmap(cc::TransferableResource&,
83 RefPtr<StaticBitmapImage>); 83 RefPtr<StaticBitmapImage>);
84 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&, 84 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&,
85 RefPtr<StaticBitmapImage>); 85 RefPtr<StaticBitmapImage>);
86 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&, 86 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&,
87 RefPtr<StaticBitmapImage>); 87 RefPtr<StaticBitmapImage>);
88 }; 88 };
89 89
90 } // namespace blink 90 } // namespace blink
91 91
92 #endif // OffscreenCanvasFrameDispatcherImpl_h 92 #endif // OffscreenCanvasFrameDispatcherImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698