| 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 // Initiates and maintains updates on Surface objects between the Browser and |
| 25 class WebLayerTreeView; | 27 // Renderer. |
| 28 class VideoSurfaceLayerBridge : public NON_EXPORTED_BASE(SurfaceLayerBridge), |
| 29 public WebVideoSurfaceLayerBridge { |
| 30 public: |
| 31 explicit VideoSurfaceLayerBridge(); |
| 32 ~VideoSurfaceLayerBridge(); |
| 26 | 33 |
| 27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { | 34 // Implementation of WebVideoLayerSurfaceBridge |
| 28 public: | 35 cc::Layer* GetLayer() { return cc_layer_.get(); } |
| 29 CanvasSurfaceLayerBridgeObserver() {} | |
| 30 virtual ~CanvasSurfaceLayerBridgeObserver() {} | |
| 31 | 36 |
| 32 virtual void OnWebLayerReplaced() = 0; | 37 // 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(); | 38 void CreateSolidColorLayer(); |
| 43 WebLayer* GetWebLayer() const { return web_layer_.get(); } | 39 void SatisfyCallback(const cc::SurfaceSequence&); |
| 44 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } | 40 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); |
| 45 | 41 |
| 46 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient | 42 // Implementation of blink::mojom::blink::OffscreenCanvasSurfaceClient |
| 47 void OnSurfaceCreated(const cc::SurfaceInfo&) override; | 43 void OnSurfaceCreated(const cc::SurfaceInfo&) override; |
| 48 | 44 |
| 49 void SatisfyCallback(const cc::SurfaceSequence&); | 45 const cc::FrameSinkId& GetFrameSinkId() const { return frame_sink_id_; } |
| 50 void RequireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | |
| 51 | 46 |
| 52 private: | 47 private: |
| 53 scoped_refptr<cc::Layer> cc_layer_; | 48 scoped_refptr<cc::Layer> cc_layer_; |
| 54 std::unique_ptr<WebLayer> web_layer_; | |
| 55 | 49 |
| 56 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; | 50 scoped_refptr<cc::SurfaceReferenceFactory> ref_factory_; |
| 57 base::WeakPtrFactory<CanvasSurfaceLayerBridge> weak_factory_; | 51 base::WeakPtrFactory<SurfaceLayerBridge> weak_factory_; |
| 58 | |
| 59 CanvasSurfaceLayerBridgeObserver* 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 |