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 "base/memory/weak_ptr.h" | |
8 #include "cc/surfaces/surface_id.h" | 9 #include "cc/surfaces/surface_id.h" |
9 #include "cc/surfaces/surface_id_allocator.h" | 10 #include "cc/surfaces/surface_id_allocator.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 11 #include "mojo/public/cpp/bindings/interface_request.h" |
11 #include "mojo/public/cpp/bindings/string.h" | 12 #include "mojo/public/cpp/bindings/string.h" |
12 #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_c anvas_surface.mojom.h" | 13 #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_c anvas_surface.mojom.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 class OffscreenCanvasSurfaceImpl : public blink::mojom::OffscreenCanvasSurface { | 17 class OffscreenCanvasSurfaceImpl : public blink::mojom::OffscreenCanvasSurface { |
17 public: | 18 public: |
18 OffscreenCanvasSurfaceImpl(); | 19 OffscreenCanvasSurfaceImpl(); |
19 ~OffscreenCanvasSurfaceImpl() override; | 20 ~OffscreenCanvasSurfaceImpl() override; |
20 | 21 |
21 static void Create(blink::mojom::OffscreenCanvasSurfaceRequest request); | 22 static void Create(blink::mojom::OffscreenCanvasSurfaceRequest request); |
22 | 23 |
23 // blink::mojom::OffscreenCanvasSurface implementation. | 24 // blink::mojom::OffscreenCanvasSurface implementation. |
24 void GetSurfaceId(const GetSurfaceIdCallback& callback) override; | 25 void GetSurfaceId(uint32_t canvas_id, |
26 const GetSurfaceIdCallback& callback) override; | |
25 void Require(const cc::SurfaceId& surface_id, | 27 void Require(const cc::SurfaceId& surface_id, |
26 const cc::SurfaceSequence& sequence) override; | 28 const cc::SurfaceSequence& sequence) override; |
27 void Satisfy(const cc::SurfaceSequence& sequence) override; | 29 void Satisfy(const cc::SurfaceSequence& sequence) override; |
28 | 30 |
31 base::WeakPtr<OffscreenCanvasSurfaceImpl> GetWeakPtr() { | |
32 return weak_factory_.GetWeakPtr(); | |
33 } | |
34 | |
29 private: | 35 private: |
30 // Surface-related state | 36 // Surface-related state |
31 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; | 37 std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; |
32 cc::SurfaceId surface_id_; | 38 cc::SurfaceId surface_id_; |
33 | 39 |
40 // Each OffscreenCanvasSurfaceImpl instance takes care of one transferred | |
41 // HTMLCanvasElement with a unique canvas id. | |
42 int canvas_id_; | |
dcheng
2016/11/08 18:30:23
Nit: ditto, make sure the types match please.
xlai (Olivia)
2016/11/10 15:45:11
Sure. I make all of them to be int32_t. I think we
| |
43 | |
44 base::WeakPtrFactory<OffscreenCanvasSurfaceImpl> weak_factory_; | |
45 | |
34 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); | 46 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); |
35 }; | 47 }; |
36 | 48 |
37 } // namespace content | 49 } // namespace content |
38 | 50 |
39 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ | 51 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ |
OLD | NEW |