OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 VideoSurfaceLayerBridge_h |
6 #define CanvasSurfaceLayerBridge_h | 6 #define VideoSurfaceLayerBridge_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 "platform/graphics/SurfaceLayerBridge.h" | |
16 #include "public/platform/WebVideoSurfaceLayerBridge.h" | |
15 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" | 17 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom -blink.h" |
16 | 18 |
17 namespace cc { | 19 namespace cc { |
18 class Layer; | 20 class Layer; |
19 class SurfaceInfo; | 21 class SurfaceInfo; |
20 } // namespace cc | 22 } // namespace cc |
21 | 23 |
22 namespace blink { | 24 namespace blink { |
23 | 25 |
24 class WebLayer; | 26 class VideoSurfaceLayerBridge : public NON_EXPORTED_BASE(SurfaceLayerBridge), |
liberato (no reviews please)
2017/06/26 22:39:30
many of these classes could use a few lines of cla
CJ
2017/06/29 19:51:33
Done. Please review my wording.
| |
25 class WebLayerTreeView; | 27 public WebVideoSurfaceLayerBridge { |
28 public: | |
29 explicit VideoSurfaceLayerBridge(WebSurfaceLayerBridgeObserver*); | |
30 ~VideoSurfaceLayerBridge(); | |
26 | 31 |
27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { | 32 // Implementation of WebVideoLayerSurfaceBridge |
28 public: | 33 cc::Layer* GetLayer() { return cc_layer_.get(); } |
29 CanvasSurfaceLayerBridgeObserver() {} | |
30 virtual ~CanvasSurfaceLayerBridgeObserver() {} | |
31 | 34 |
32 virtual void OnWebLayerReplaced() = 0; | 35 // Implemenation of SurfaceLayerBridge |
33 }; | |
34 | |
35 class PLATFORM_EXPORT CanvasSurfaceLayerBridge | |
36 : NON_EXPORTED_BASE( | |
37 public blink::mojom::blink::OffscreenCanvasSurfaceClient) { | |
38 public: | |
39 explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*, | |
40 WebLayerTreeView*); | |
41 ~CanvasSurfaceLayerBridge(); | |
42 void CreateSolidColorLayer(); | 36 void CreateSolidColorLayer(); |
43 WebLayer* GetWebLayer() const { return web_layer_.get(); } | 37 void SatisfyCallback(const cc::SurfaceSequence&); |
44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } | 38 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); |
45 | 39 |
46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient | 40 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient |
47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; | 41 void OnSurfaceCreated(const cc::SurfaceInfo&) override; |
48 | 42 |
49 void SatisfyCallback(const cc::SurfaceSequence&); | 43 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } |
50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | |
51 | 44 |
52 private: | 45 private: |
53 scoped_refptr<cc::Layer> cc_layer_; | 46 scoped_refptr<cc::Layer> cc_layer_; |
54 std::unique_ptr<WebLayer> web_layer_; | |
55 | 47 |
56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; | 48 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; |
57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_; | 49 base::WeakPtrFactory<SurfaceLayerBridge> weak_factory_; |
58 | 50 |
59 CanvasSurfaceLayerBridgeObserver* observer_; | 51 WebSurfaceLayerBridgeObserver* observer_; |
60 | 52 |
61 mojom::blink::OffscreenCanvasSurfacePtr service_; | 53 mojom::blink::OffscreenCanvasSurfacePtr service_; |
62 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; | 54 mojo::Binding<blink::mojom::blink::OffscreenCanvasSurfaceClient> binding_; |
63 | 55 |
64 const cc::FrameSinkId frame_sink_id_; | 56 const cc::FrameSinkId frame_sink_id_; |
65 cc::SurfaceId current_surface_id_; | 57 cc::SurfaceId current_surface_id_; |
66 const cc::FrameSinkId parent_frame_sink_id_; | 58 const cc::FrameSinkId parent_frame_sink_id_; |
67 }; | 59 }; |
68 | 60 |
69 } // namespace blink | 61 } // namespace blink |
70 | 62 |
71 #endif // CanvasSurfaceLayerBridge_h | 63 #endif // VideoSurfaceLayerBridge_h |
OLD | NEW |