| 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" | 
| 10 #include "cc/surfaces/surface_id.h" | 10 #include "cc/surfaces/surface_id.h" | 
| 11 #include "cc/surfaces/surface_reference_factory.h" | 11 #include "cc/surfaces/surface_reference_factory.h" | 
| 12 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" | 
| 13 #include "platform/PlatformExport.h" | 13 #include "platform/PlatformExport.h" | 
| 14 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
    -blink.h" | 14 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
    -blink.h" | 
| 15 #include <memory> | 15 #include <memory> | 
| 16 | 16 | 
| 17 namespace cc { | 17 namespace cc { | 
| 18 class Layer; | 18 class Layer; | 
| 19 class SurfaceInfo; | 19 class SurfaceInfo; | 
| 20 }  // namespace cc | 20 }  // namespace cc | 
| 21 | 21 | 
| 22 namespace blink { | 22 namespace blink { | 
| 23 | 23 | 
| 24 class WebLayer; | 24 class WebLayer; | 
|  | 25 class WebLayerTreeView; | 
| 25 | 26 | 
| 26 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { | 27 class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { | 
| 27  public: | 28  public: | 
| 28   CanvasSurfaceLayerBridgeObserver() {} | 29   CanvasSurfaceLayerBridgeObserver() {} | 
| 29   virtual ~CanvasSurfaceLayerBridgeObserver() {} | 30   virtual ~CanvasSurfaceLayerBridgeObserver() {} | 
| 30 | 31 | 
| 31   virtual void OnWebLayerReplaced() = 0; | 32   virtual void OnWebLayerReplaced() = 0; | 
| 32 }; | 33 }; | 
| 33 | 34 | 
| 34 class PLATFORM_EXPORT CanvasSurfaceLayerBridge | 35 class PLATFORM_EXPORT CanvasSurfaceLayerBridge | 
| 35     : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) { | 36     : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) { | 
| 36  public: | 37  public: | 
| 37   explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*); | 38   explicit CanvasSurfaceLayerBridge(CanvasSurfaceLayerBridgeObserver*, | 
|  | 39                                     WebLayerTreeView*); | 
| 38   ~CanvasSurfaceLayerBridge(); | 40   ~CanvasSurfaceLayerBridge(); | 
| 39   void createSolidColorLayer(); | 41   void createSolidColorLayer(); | 
| 40   WebLayer* getWebLayer() const { return m_webLayer.get(); } | 42   WebLayer* getWebLayer() const { return m_webLayer.get(); } | 
| 41   const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; } | 43   const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; } | 
| 42 | 44 | 
| 43   // Implementation of mojom::blink::OffscreenCanvasSurfaceClient | 45   // Implementation of mojom::blink::OffscreenCanvasSurfaceClient | 
| 44   void OnSurfaceCreated(const cc::SurfaceInfo&) override; | 46   void OnSurfaceCreated(const cc::SurfaceInfo&) override; | 
| 45 | 47 | 
| 46   void satisfyCallback(const cc::SurfaceSequence&); | 48   void satisfyCallback(const cc::SurfaceSequence&); | 
| 47   void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | 49   void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); | 
| 48 | 50 | 
| 49  private: | 51  private: | 
| 50   scoped_refptr<cc::Layer> m_CCLayer; | 52   scoped_refptr<cc::Layer> m_CCLayer; | 
| 51   std::unique_ptr<WebLayer> m_webLayer; | 53   std::unique_ptr<WebLayer> m_webLayer; | 
| 52 | 54 | 
| 53   scoped_refptr<cc::SurfaceReferenceFactory> m_refFactory; | 55   scoped_refptr<cc::SurfaceReferenceFactory> m_refFactory; | 
| 54   base::WeakPtrFactory<CanvasSurfaceLayerBridge> m_weakFactory; | 56   base::WeakPtrFactory<CanvasSurfaceLayerBridge> m_weakFactory; | 
| 55 | 57 | 
| 56   CanvasSurfaceLayerBridgeObserver* m_observer; | 58   CanvasSurfaceLayerBridgeObserver* m_observer; | 
| 57 | 59 | 
| 58   mojom::blink::OffscreenCanvasSurfacePtr m_service; | 60   mojom::blink::OffscreenCanvasSurfacePtr m_service; | 
| 59   mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding; | 61   mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding; | 
| 60 | 62 | 
| 61   cc::FrameSinkId m_frameSinkId; | 63   const cc::FrameSinkId m_frameSinkId; | 
| 62   cc::SurfaceId m_currentSurfaceId; | 64   cc::SurfaceId m_currentSurfaceId; | 
|  | 65   const cc::FrameSinkId m_parentFrameSinkId; | 
| 63 }; | 66 }; | 
| 64 | 67 | 
| 65 }  // namespace blink | 68 }  // namespace blink | 
| 66 | 69 | 
| 67 #endif  // CanvasSurfaceLayerBridge_h | 70 #endif  // CanvasSurfaceLayerBridge_h | 
| OLD | NEW | 
|---|