OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_SERVICE_IMPL_H_ |
| 7 |
| 8 #include "cc/surfaces/surface_factory.h" |
| 9 #include "cc/surfaces/surface_factory_client.h" |
| 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "cc/surfaces/surface_id_allocator.h" |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" |
| 13 #include "mojo/public/cpp/bindings/string.h" |
| 14 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 15 #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_c
anvas_surface_service.mojom.h" |
| 16 |
| 17 namespace content { |
| 18 |
| 19 class OffscreenCanvasSurfaceServiceImpl |
| 20 : public blink::mojom::OffscreenCanvasSurfaceService, |
| 21 public cc::SurfaceFactoryClient { |
| 22 public: |
| 23 static void Create( |
| 24 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurfaceService> |
| 25 request); |
| 26 ~OffscreenCanvasSurfaceServiceImpl() override; |
| 27 |
| 28 void GetSurfaceId(const GetSurfaceIdCallback& callback) override; |
| 29 void RequestSurfaceCreation( |
| 30 const blink::mojom::SurfaceIdPtr surface_id) override; |
| 31 void Require(blink::mojom::SurfaceIdPtr surface_id, |
| 32 blink::mojom::SurfaceSequencePtr sequence) override; |
| 33 void Satisfy(blink::mojom::SurfaceSequencePtr sequence) override; |
| 34 |
| 35 // cc::SurfaceFactoryClient implementation. |
| 36 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 37 void WillDrawSurface(cc::SurfaceId id, |
| 38 const gfx::Rect& damage_rect) override; |
| 39 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 40 |
| 41 private: |
| 42 explicit OffscreenCanvasSurfaceServiceImpl( |
| 43 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasSurfaceService> |
| 44 request); |
| 45 |
| 46 // Surface-related state |
| 47 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; |
| 48 std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 49 |
| 50 mojo::StrongBinding<blink::mojom::OffscreenCanvasSurfaceService> binding_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceServiceImpl); |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_SERVICE_IMPL_H_ |
OLD | NEW |