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 CanvasSurfaceLayerBridge_h | 5 #ifndef CanvasSurfaceLayerBridge_h |
6 #define CanvasSurfaceLayerBridge_h | 6 #define CanvasSurfaceLayerBridge_h |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "cc/surfaces/surface_id.h" | 9 #include "cc/surfaces/surface_id.h" |
10 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
11 #include "platform/graphics/CanvasSurfaceLayerBridgeClient.h" | 11 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 class SurfaceLayer; | 15 class SurfaceLayer; |
16 struct SurfaceSequence; | 16 struct SurfaceSequence; |
17 } // namespace cc | 17 } // namespace cc |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class WebLayer; | 21 class WebLayer; |
22 | 22 |
23 class PLATFORM_EXPORT CanvasSurfaceLayerBridge { | 23 class PLATFORM_EXPORT CanvasSurfaceLayerBridge { |
24 public: | 24 public: |
25 explicit CanvasSurfaceLayerBridge(std::unique_ptr<CanvasSurfaceLayerBridgeCl
ient>); | 25 explicit CanvasSurfaceLayerBridge(mojom::blink::OffscreenCanvasSurfacePtr); |
26 ~CanvasSurfaceLayerBridge(); | 26 ~CanvasSurfaceLayerBridge(); |
27 bool createSurfaceLayer(int canvasWidth, int canvasHeight); | 27 bool createSurfaceLayer(int canvasWidth, int canvasHeight); |
28 WebLayer* getWebLayer() const { return m_webLayer.get(); } | 28 WebLayer* getWebLayer() const { return m_webLayer.get(); } |
29 const cc::SurfaceId& getSurfaceId() const { return m_surfaceId; } | 29 const cc::SurfaceId& getSurfaceId() const { return m_surfaceId; } |
30 CanvasSurfaceLayerBridgeClient* getClient() const { return m_client.get(); } | |
31 | 30 |
32 void satisfyCallback(const cc::SurfaceSequence&); | 31 void satisfyCallback(const cc::SurfaceSequence&); |
33 void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | 32 void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); |
34 | 33 |
35 private: | 34 private: |
36 scoped_refptr<cc::SurfaceLayer> m_surfaceLayer; | 35 scoped_refptr<cc::SurfaceLayer> m_surfaceLayer; |
37 std::unique_ptr<WebLayer> m_webLayer; | 36 std::unique_ptr<WebLayer> m_webLayer; |
38 std::unique_ptr<CanvasSurfaceLayerBridgeClient> m_client; | 37 mojom::blink::OffscreenCanvasSurfacePtr m_service; |
39 cc::SurfaceId m_surfaceId; | 38 cc::SurfaceId m_surfaceId; |
40 }; | 39 }; |
41 | 40 |
42 } // namespace blink | 41 } // namespace blink |
43 | 42 |
44 #endif // CanvasSurfaceLayerBridge_h | 43 #endif // CanvasSurfaceLayerBridge_h |
OLD | NEW |