OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_ |
| 7 |
| 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/surfaces/surface_id.h" |
| 11 #include "cc/surfaces/surface_observer.h" |
| 12 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class CONTENT_EXPORT OffscreenCanvasSurfaceManager |
| 17 : public cc::SurfaceObserver { |
| 18 public: |
| 19 OffscreenCanvasSurfaceManager(); |
| 20 virtual ~OffscreenCanvasSurfaceManager(); |
| 21 |
| 22 static OffscreenCanvasSurfaceManager* GetInstance(); |
| 23 |
| 24 void RegisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId, |
| 25 OffscreenCanvasSurfaceImpl*); |
| 26 void UnregisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId); |
| 27 OffscreenCanvasSurfaceImpl* GetSurfaceInstance(cc::FrameSinkId); |
| 28 |
| 29 private: |
| 30 friend class OffscreenCanvasSurfaceManagerTest; |
| 31 |
| 32 // cc::SurfaceObserver implementation. |
| 33 // TODO(crbug.com/662498): Implement these functions when |
| 34 // OffscreenCanvasSurfaceManager must propagate the resizing information |
| 35 // back to renderer/main. |
| 36 void OnSurfaceCreated(const cc::SurfaceId& surface_id, |
| 37 const gfx::Size& frame_size, |
| 38 float device_scale_factor) override {} |
| 39 void OnSurfaceDamaged(const cc::SurfaceId&, bool* changed) override {} |
| 40 |
| 41 std::unordered_map<cc::FrameSinkId, |
| 42 base::WeakPtr<OffscreenCanvasSurfaceImpl>, |
| 43 cc::FrameSinkIdHash> |
| 44 registered_surface_instances_; |
| 45 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceManager); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_ |
OLD | NEW |