Chromium Code Reviews| Index: content/browser/renderer_host/offscreen_canvas_provider_impl.h |
| diff --git a/content/browser/renderer_host/offscreen_canvas_provider_impl.h b/content/browser/renderer_host/offscreen_canvas_provider_impl.h |
| index 554e121a39a7b453d9d4a82aaf9ee8a8e05f1ea8..75ae94fe58ee402db6eccb614cd13e138c17d480 100644 |
| --- a/content/browser/renderer_host/offscreen_canvas_provider_impl.h |
| +++ b/content/browser/renderer_host/offscreen_canvas_provider_impl.h |
| @@ -5,14 +5,20 @@ |
| #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_PROVIDER_IMPL_H_ |
| #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_PROVIDER_IMPL_H_ |
| +#include <memory> |
| +#include <unordered_map> |
| + |
| #include "cc/surfaces/frame_sink_id.h" |
| +#include "content/common/content_export.h" |
| #include "mojo/public/cpp/bindings/binding_set.h" |
| #include "third_party/WebKit/public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom.h" |
| namespace content { |
| +class OffscreenCanvasSurfaceImpl; |
| + |
| // Creates OffscreenCanvasSurfaces and MojoCompositorFrameSinks for a renderer. |
| -class OffscreenCanvasProviderImpl |
| +class CONTENT_EXPORT OffscreenCanvasProviderImpl |
| : public blink::mojom::OffscreenCanvasProvider { |
| public: |
| explicit OffscreenCanvasProviderImpl(uint32_t renderer_client_id); |
| @@ -20,6 +26,8 @@ class OffscreenCanvasProviderImpl |
| void Add(blink::mojom::OffscreenCanvasProviderRequest request); |
| + void DestroyOffscreenCanvasSurface(const cc::FrameSinkId& frame_sink_id); |
|
Fady Samuel
2017/04/28 04:58:00
Should this be passed by value to avoid use-after-
kylechar
2017/05/01 19:07:48
Done.
|
| + |
| // blink::mojom::OffscreenCanvasProvider implementation. |
| void CreateOffscreenCanvasSurface( |
| const cc::FrameSinkId& parent_frame_sink_id, |
| @@ -32,11 +40,18 @@ class OffscreenCanvasProviderImpl |
| cc::mojom::MojoCompositorFrameSinkRequest request) override; |
| private: |
| + friend class OffscreenCanvasProviderImplTest; |
| + |
| // FrameSinkIds for offscreen canvas must use the renderer client id. |
| const uint32_t renderer_client_id_; |
| mojo::BindingSet<blink::mojom::OffscreenCanvasProvider> bindings_; |
| + std::unordered_map<cc::FrameSinkId, |
| + std::unique_ptr<OffscreenCanvasSurfaceImpl>, |
| + cc::FrameSinkIdHash> |
| + surfaces_; |
|
Fady Samuel
2017/04/28 04:58:00
I hate how we're overloading the term surface here
kylechar
2017/05/01 19:07:48
Agreed. I think it should be OffscreenCanvasSurfac
|
| + |
| DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasProviderImpl); |
| }; |