| 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/surfaces/surface_id.h" | 8 #include "cc/surfaces/surface_id.h" |
| 9 #include "cc/surfaces/surface_id_allocator.h" | 9 #include "cc/surfaces/surface_id_allocator.h" |
| 10 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
| 11 #include "mojo/public/cpp/bindings/string.h" | 11 #include "mojo/public/cpp/bindings/string.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 #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" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class CONTENT_EXPORT OffscreenCanvasSurfaceImpl | 17 class CONTENT_EXPORT OffscreenCanvasSurfaceImpl |
| 18 : public blink::mojom::OffscreenCanvasSurface { | 18 : public blink::mojom::OffscreenCanvasSurface { |
| 19 public: | 19 public: |
| 20 OffscreenCanvasSurfaceImpl( | 20 OffscreenCanvasSurfaceImpl( |
| 21 const cc::FrameSinkId& frame_sink_id, | 21 const cc::FrameSinkId& frame_sink_id, |
| 22 blink::mojom::OffscreenCanvasSurfaceClientPtr client); | 22 blink::mojom::OffscreenCanvasSurfaceClientPtr client); |
| 23 ~OffscreenCanvasSurfaceImpl() override; | 23 ~OffscreenCanvasSurfaceImpl() override; |
| 24 | 24 |
| 25 static void Create(const cc::FrameSinkId& frame_sink_id, | 25 static void Create(const cc::FrameSinkId& frame_sink_id, |
| 26 blink::mojom::OffscreenCanvasSurfaceClientPtr client, | 26 blink::mojom::OffscreenCanvasSurfaceClientPtr client, |
| 27 blink::mojom::OffscreenCanvasSurfaceRequest request); | 27 blink::mojom::OffscreenCanvasSurfaceRequest request); |
| 28 | 28 |
| 29 void OnSurfaceCreated(const cc::SurfaceId& surface_id, | 29 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); |
| 30 const gfx::Size& frame_size, | |
| 31 float device_scale_factor); | |
| 32 | 30 |
| 33 // blink::mojom::OffscreenCanvasSurface implementation. | 31 // blink::mojom::OffscreenCanvasSurface implementation. |
| 34 void Require(const cc::SurfaceId& surface_id, | 32 void Require(const cc::SurfaceId& surface_id, |
| 35 const cc::SurfaceSequence& sequence) override; | 33 const cc::SurfaceSequence& sequence) override; |
| 36 void Satisfy(const cc::SurfaceSequence& sequence) override; | 34 void Satisfy(const cc::SurfaceSequence& sequence) override; |
| 37 | 35 |
| 38 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 36 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 39 const cc::LocalFrameId& current_local_frame_id() const { | 37 const cc::LocalFrameId& current_local_frame_id() const { |
| 40 return current_local_frame_id_; | 38 return current_local_frame_id_; |
| 41 } | 39 } |
| 42 | 40 |
| 43 private: | 41 private: |
| 44 blink::mojom::OffscreenCanvasSurfaceClientPtr client_; | 42 blink::mojom::OffscreenCanvasSurfaceClientPtr client_; |
| 45 mojo::StrongBindingPtr<blink::mojom::OffscreenCanvasSurface> binding_; | 43 mojo::StrongBindingPtr<blink::mojom::OffscreenCanvasSurface> binding_; |
| 46 | 44 |
| 47 // Surface-related state | 45 // Surface-related state |
| 48 cc::FrameSinkId frame_sink_id_; | 46 cc::FrameSinkId frame_sink_id_; |
| 49 cc::LocalFrameId current_local_frame_id_; | 47 cc::LocalFrameId current_local_frame_id_; |
| 50 | 48 |
| 51 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); | 49 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); |
| 52 }; | 50 }; |
| 53 | 51 |
| 54 } // namespace content | 52 } // namespace content |
| 55 | 53 |
| 56 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ | 54 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ |
| OLD | NEW |