Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h |
| index de6d5c82e871e0d7d510089d5f3fa163c9938213..cb99d6c0e802fd02b2db5889321754b77d1f9e1a 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h |
| +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h |
| @@ -7,11 +7,13 @@ |
| #include "base/memory/ref_counted.h" |
| #include "cc/surfaces/surface_id.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| #include "platform/PlatformExport.h" |
| #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom-blink.h" |
| #include <memory> |
| namespace cc { |
| +class SolidColorLayer; |
| class SurfaceLayer; |
| struct SurfaceSequence; |
| } // namespace cc |
| @@ -20,22 +22,45 @@ namespace blink { |
| class WebLayer; |
| -class PLATFORM_EXPORT CanvasSurfaceLayerBridge { |
| +class PLATFORM_EXPORT CanvasSurfaceLayerBridgeObserver { |
| public: |
| - explicit CanvasSurfaceLayerBridge(mojom::blink::OffscreenCanvasSurfacePtr); |
| + CanvasSurfaceLayerBridgeObserver() {} |
| + virtual ~CanvasSurfaceLayerBridgeObserver() {} |
| + |
| + virtual void OnWebLayerReplaced() = 0; |
| +}; |
| + |
| +class PLATFORM_EXPORT CanvasSurfaceLayerBridge |
| + : NON_EXPORTED_BASE(public mojom::blink::OffscreenCanvasSurfaceClient) { |
| + public: |
| + explicit CanvasSurfaceLayerBridge(mojom::blink::OffscreenCanvasSurfacePtr, |
| + CanvasSurfaceLayerBridgeObserver*); |
| ~CanvasSurfaceLayerBridge(); |
| - bool createSurfaceLayer(int canvasWidth, int canvasHeight); |
| + void createSolidColorLayer(); |
| WebLayer* getWebLayer() const { return m_webLayer.get(); } |
| - const cc::SurfaceId& getSurfaceId() const { return m_surfaceId; } |
| + const cc::FrameSinkId& getFrameSinkId() const { return m_frameSinkId; } |
| + |
| + // Implementation of mojom::blink::OffscreenCanvasSurfaceClient |
| + void OnSurfaceCreated(const cc::SurfaceId&, |
| + int32_t width, |
| + int32_t height, |
| + float deviceScaleFactor) override; |
| void satisfyCallback(const cc::SurfaceSequence&); |
| void requireCallback(const cc::SurfaceId&, const cc::SurfaceSequence&); |
| private: |
| scoped_refptr<cc::SurfaceLayer> m_surfaceLayer; |
| + scoped_refptr<cc::SolidColorLayer> m_solidColorLayer; |
|
Justin Novosad
2016/12/15 22:19:35
It would be cleaner to have a single reference to
xlai (Olivia)
2016/12/15 22:46:27
Done. I shouldn't keep the SolidColorLayer; that w
|
| std::unique_ptr<WebLayer> m_webLayer; |
| + |
| + CanvasSurfaceLayerBridgeObserver* m_observer; |
| + |
| mojom::blink::OffscreenCanvasSurfacePtr m_service; |
| - cc::SurfaceId m_surfaceId; |
| + mojo::Binding<mojom::blink::OffscreenCanvasSurfaceClient> m_binding; |
| + |
| + cc::FrameSinkId m_frameSinkId; |
| + cc::SurfaceId m_currentSurfaceId; |
| }; |
| } // namespace blink |