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 SurfaceLayerBridge_h |
6 #define CanvasSurfaceLayerBridge_h | 6 #define SurfaceLayerBridge_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "cc/surfaces/surface_id.h" | 11 #include "cc/surfaces/surface_id.h" |
12 #include "cc/surfaces/surface_reference_factory.h" | 12 #include "cc/surfaces/surface_reference_factory.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "platform/PlatformExport.h" | 14 #include "platform/PlatformExport.h" |
15 #include "public/platform/WebVideoSurfaceLayerBridge.h" | |
15 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" | 16 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" |
16 | 17 |
17 namespace cc { | 18 namespace cc { |
18 class Layer; | 19 class Layer; |
19 class SurfaceInfo; | 20 class SurfaceInfo; |
20 } // namespace cc | 21 } // namespace cc |
21 | 22 |
22 namespace blink { | 23 namespace blink { |
23 | 24 |
24 class WebLayer; | 25 class WebLayer; |
25 class WebLayerTreeView; | 26 class WebLayerTreeView; |
26 | 27 |
27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { | 28 class PLATFORM_EXPORT SurfaceLayerBridgeObserver { |
28 public: | 29 public: |
29 CanvasSurfaceLayerBridgeObserver() {} | 30 SurfaceLayerBridgeObserver() {} |
30 virtual ~CanvasSurfaceLayerBridgeObserver() {} | 31 virtual ~SurfaceLayerBridgeObserver() {} |
31 | 32 |
32 virtual void OnWebLayerReplaced() = 0; | 33 virtual void OnWebLayerReplaced() = 0; |
33 }; | 34 }; |
34 | 35 |
35 class PLATFORM_EXPORT CanvasSurfaceLayerBridge | 36 class PLATFORM_EXPORT SurfaceLayerBridge |
36 : NON_EXPORTED_BASE( | 37 : public NON_EXPORTED_BASE( |
37 public blink::mojom::blink::OffscreenCanvasSurfaceClient) { | 38 blink::mojom::blink::OffscreenCanvasSurfaceClient), |
39 public WebVideoSurfaceLayerBridge { | |
liberato (no reviews please)
2017/07/06 16:56:18
not sure that SurfaceLayerBridge should implement
CJ
2017/07/06 20:45:19
Done.
| |
38 public: | 40 public: |
39 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*, | 41 explicit SurfaceLayerBridge(SurfaceLayerBridgeObserver*, WebLayerTreeView*); |
40 WebLayerTreeView*); | 42 ~SurfaceLayerBridge(); |
41 ~CanvasSurfaceLayerBridge(); | 43 |
42 void CreateSolidColorLayer(); | 44 void CreateSolidColorLayer(); |
43 WebLayer* GetWebLayer() const { return web_layer_.get(); } | |
44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } | |
45 | 45 |
46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient | 46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient |
47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; | 47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; |
48 | |
49 void SatisfyCallback(const cc::SurfaceSequence&); | 48 void SatisfyCallback(const cc::SurfaceSequence&); |
50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | 49 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); |
51 | 50 |
51 // Implementation of WebVideoSurfaceLayerBridge. | |
52 WebLayer* GetWebLayer() const override { return web_layer_.get(); } | |
53 cc::Layer* GetCCLayer() const override { return cc_layer_.get(); } | |
liberato (no reviews please)
2017/07/06 16:56:18
is there any case where this isn't the same as web
CJ
2017/07/06 20:45:19
For some reason I thought it was available on WebL
| |
54 | |
55 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } | |
56 | |
52 private: | 57 private: |
58 mojom::blink::OffscreenCanvasSurfacePtr service_; | |
59 | |
53 scoped_refptr<cc::Layer> cc_layer_; | 60 scoped_refptr<cc::Layer> cc_layer_; |
54 std::unique_ptr<WebLayer> web_layer_; | 61 std::unique_ptr<WebLayer> web_layer_; |
55 | 62 |
56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; | 63 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; |
57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_; | 64 base::WeakPtrFactory<SurfaceLayerBridge> weak_factory_; |
58 | 65 |
59 CanvasSurfaceLayerBridgeObserver* observer_; | 66 SurfaceLayerBridgeObserver* observer_; |
60 | 67 |
61 mojom::blink::OffscreenCanvasSurfacePtr service_; | |
62 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; | 68 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; |
63 | 69 |
64 const cc::FrameSinkId frame_sink_id_; | 70 const cc::FrameSinkId frame_sink_id_; |
65 cc::SurfaceId current_surface_id_; | 71 cc::SurfaceId current_surface_id_; |
66 const cc::FrameSinkId parent_frame_sink_id_; | 72 const cc::FrameSinkId parent_frame_sink_id_; |
67 }; | 73 }; |
68 | 74 |
69 } // namespace blink | 75 } // namespace blink |
70 | 76 |
71 #endif // CanvasSurfaceLayerBridge_h | 77 #endif // SurfaceLayerBridge_h |
OLD | NEW |