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/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 "cc/surfaces/surface_id_allocator.h" | 12 #include "cc/surfaces/surface_id_allocator.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" | 14 #include "platform/graphics/OffscreenCanvasFrameDispatcher.h" |
15 #include "platform/graphics/StaticBitmapImage.h" | 15 #include "platform/graphics/StaticBitmapImage.h" |
16 #include "wtf/Compiler.h" | 16 #include "wtf/Compiler.h" |
17 #include <memory> | 17 #include <memory> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcherImpl final | 21 class PLATFORM_EXPORT OffscreenCanvasFrameDispatcherImpl final |
22 : public OffscreenCanvasFrameDispatcher, | 22 : public OffscreenCanvasFrameDispatcher, |
23 NON_EXPORTED_BASE( | 23 NON_EXPORTED_BASE( |
24 public cc::mojom::blink::MojoCompositorFrameSinkClient) { | 24 public cc::mojom::blink::MojoCompositorFrameSinkClient) { |
25 public: | 25 public: |
26 OffscreenCanvasFrameDispatcherImpl(uint32_t clientId, | 26 OffscreenCanvasFrameDispatcherImpl(OffscreenCanvasFrameDispatcherClient*, |
| 27 uint32_t clientId, |
27 uint32_t sinkId, | 28 uint32_t sinkId, |
28 int canvasId, | 29 int canvasId, |
29 int width, | 30 int width, |
30 int height); | 31 int height); |
31 | 32 |
32 // OffscreenCanvasFrameDispatcher implementation. | 33 // OffscreenCanvasFrameDispatcher implementation. |
33 ~OffscreenCanvasFrameDispatcherImpl() override {} | 34 ~OffscreenCanvasFrameDispatcherImpl() final; |
34 void dispatchFrame(RefPtr<StaticBitmapImage>, | 35 void dispatchFrame(RefPtr<StaticBitmapImage>, |
35 double commitStartTime, | 36 double commitStartTime, |
36 bool isWebGLSoftwareRendering = false) override; | 37 bool isWebGLSoftwareRendering = false) final; |
37 void reclaimResource(unsigned resourceId) override; | 38 void reclaimResource(unsigned resourceId) final; |
| 39 void reshape(int width, int height) final; |
38 | 40 |
39 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. | 41 // cc::mojom::blink::MojoCompositorFrameSinkClient implementation. |
40 void DidReceiveCompositorFrameAck() override; | 42 void DidReceiveCompositorFrameAck() final; |
41 void OnBeginFrame(const cc::BeginFrameArgs&) override; | 43 void OnBeginFrame(const cc::BeginFrameArgs&) final; |
42 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 44 void ReclaimResources(const cc::ReturnedResourceArray& resources) final; |
43 void WillDrawSurface() override; | 45 void WillDrawSurface() final; |
44 | 46 |
45 // This enum is used in histogram, so it should be append-only. | 47 // This enum is used in histogram, so it should be append-only. |
46 enum OffscreenCanvasCommitType { | 48 enum OffscreenCanvasCommitType { |
47 CommitGPUCanvasGPUCompositing = 0, | 49 CommitGPUCanvasGPUCompositing = 0, |
48 CommitGPUCanvasSoftwareCompositing = 1, | 50 CommitGPUCanvasSoftwareCompositing = 1, |
49 CommitSoftwareCanvasGPUCompositing = 2, | 51 CommitSoftwareCanvasGPUCompositing = 2, |
50 CommitSoftwareCanvasSoftwareCompositing = 3, | 52 CommitSoftwareCanvasSoftwareCompositing = 3, |
51 OffscreenCanvasCommitTypeCount, | 53 OffscreenCanvasCommitTypeCount, |
52 }; | 54 }; |
53 | 55 |
54 void reshape(int width, int height) override; | |
55 | |
56 private: | 56 private: |
57 // Surface-related | 57 // Surface-related |
58 cc::SurfaceIdAllocator m_surfaceIdAllocator; | 58 cc::SurfaceIdAllocator m_surfaceIdAllocator; |
| 59 void scheduleSyntheticBeginFrame(); // To be removed (crbug.com/674744) |
| 60 |
| 61 TaskHandle m_syntheticBeginFrameTask; // To be removed (crbug.com/674744) |
59 const cc::FrameSinkId m_frameSinkId; | 62 const cc::FrameSinkId m_frameSinkId; |
60 cc::LocalFrameId m_currentLocalFrameId; | 63 cc::LocalFrameId m_currentLocalFrameId; |
61 | 64 |
62 int m_width; | 65 int m_width; |
63 int m_height; | 66 int m_height; |
64 | 67 |
65 unsigned m_nextResourceId; | 68 unsigned m_nextResourceId; |
66 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; | 69 HashMap<unsigned, RefPtr<StaticBitmapImage>> m_cachedImages; |
67 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps; | 70 HashMap<unsigned, std::unique_ptr<cc::SharedBitmap>> m_sharedBitmaps; |
68 HashMap<unsigned, GLuint> m_cachedTextureIds; | 71 HashMap<unsigned, GLuint> m_cachedTextureIds; |
(...skipping 10 matching lines...) Expand all Loading... |
79 RefPtr<StaticBitmapImage>); | 82 RefPtr<StaticBitmapImage>); |
80 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&, | 83 void setTransferableResourceToSharedGPUContext(cc::TransferableResource&, |
81 RefPtr<StaticBitmapImage>); | 84 RefPtr<StaticBitmapImage>); |
82 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&, | 85 void setTransferableResourceToStaticBitmapImage(cc::TransferableResource&, |
83 RefPtr<StaticBitmapImage>); | 86 RefPtr<StaticBitmapImage>); |
84 }; | 87 }; |
85 | 88 |
86 } // namespace blink | 89 } // namespace blink |
87 | 90 |
88 #endif // OffscreenCanvasFrameDispatcherImpl_h | 91 #endif // OffscreenCanvasFrameDispatcherImpl_h |
OLD | NEW |