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