| 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/ipc/display_compositor.mojom.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/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.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 CONTENT_EXPORT OffscreenCanvasSurfaceImpl | 17 class CONTENT_EXPORT OffscreenCanvasSurfaceImpl |
| 17 : public blink::mojom::OffscreenCanvasSurface { | 18 : public blink::mojom::OffscreenCanvasSurface { |
| 18 public: | 19 public: |
| 19 OffscreenCanvasSurfaceImpl( | 20 OffscreenCanvasSurfaceImpl(const cc::FrameSinkId& parent_frame_sink_id, |
| 20 const cc::FrameSinkId& parent_frame_sink_id, | 21 const cc::FrameSinkId& frame_sink_id, |
| 21 const cc::FrameSinkId& frame_sink_id, | 22 cc::mojom::DisplayCompositorClientPtr client); |
| 22 blink::mojom::OffscreenCanvasSurfaceClientPtr client); | |
| 23 ~OffscreenCanvasSurfaceImpl() override; | 23 ~OffscreenCanvasSurfaceImpl() override; |
| 24 | 24 |
| 25 static void Create(const cc::FrameSinkId& parent_frame_sink_id, | 25 static void Create(const cc::FrameSinkId& parent_frame_sink_id, |
| 26 const cc::FrameSinkId& frame_sink_id, | 26 const cc::FrameSinkId& frame_sink_id, |
| 27 blink::mojom::OffscreenCanvasSurfaceClientPtr client, | 27 cc::mojom::DisplayCompositorClientPtr client, |
| 28 blink::mojom::OffscreenCanvasSurfaceRequest request); | 28 blink::mojom::OffscreenCanvasSurfaceRequest request); |
| 29 | 29 |
| 30 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); | 30 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); |
| 31 | 31 |
| 32 // blink::mojom::OffscreenCanvasSurface implementation. | 32 // blink::mojom::OffscreenCanvasSurface implementation. |
| 33 void Require(const cc::SurfaceId& surface_id, | 33 void Require(const cc::SurfaceId& surface_id, |
| 34 const cc::SurfaceSequence& sequence) override; | 34 const cc::SurfaceSequence& sequence) override; |
| 35 void Satisfy(const cc::SurfaceSequence& sequence) override; | 35 void Satisfy(const cc::SurfaceSequence& sequence) override; |
| 36 | 36 |
| 37 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 37 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 38 | 38 |
| 39 const cc::FrameSinkId& parent_frame_sink_id() const { | 39 const cc::FrameSinkId& parent_frame_sink_id() const { |
| 40 return parent_frame_sink_id_; | 40 return parent_frame_sink_id_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 const cc::LocalSurfaceId& current_local_surface_id() const { | 43 const cc::LocalSurfaceId& current_local_surface_id() const { |
| 44 return current_local_surface_id_; | 44 return current_local_surface_id_; |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 blink::mojom::OffscreenCanvasSurfaceClientPtr client_; | 48 cc::mojom::DisplayCompositorClientPtr client_; |
| 49 mojo::StrongBindingPtr<blink::mojom::OffscreenCanvasSurface> binding_; | 49 mojo::StrongBindingPtr<blink::mojom::OffscreenCanvasSurface> binding_; |
| 50 | 50 |
| 51 // Surface-related state | 51 // Surface-related state |
| 52 const cc::FrameSinkId frame_sink_id_; | 52 const cc::FrameSinkId frame_sink_id_; |
| 53 cc::LocalSurfaceId current_local_surface_id_; | 53 cc::LocalSurfaceId current_local_surface_id_; |
| 54 const cc::FrameSinkId parent_frame_sink_id_; | 54 const cc::FrameSinkId parent_frame_sink_id_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); | 56 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceImpl); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace content | 59 } // namespace content |
| 60 | 60 |
| 61 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ | 61 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_IMPL_H_ |
| OLD | NEW |