Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: content/browser/renderer_host/offscreen_canvas_surface_manager.h

Issue 2479563005: Create manager to track OffscreenCanvasSurfaceImpl instances (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/memory/weak_ptr.h"
9 #include "cc/surfaces/surface_id.h"
10 #include "cc/surfaces/surface_observer.h"
11 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h"
12
13 namespace content {
14
15 class CONTENT_EXPORT OffscreenCanvasSurfaceManager
16 : public cc::SurfaceObserver {
17 public:
18 OffscreenCanvasSurfaceManager();
19 virtual ~OffscreenCanvasSurfaceManager();
20
21 static OffscreenCanvasSurfaceManager* GetInstance();
22
23 void RegisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId,
24 OffscreenCanvasSurfaceImpl*);
25 void UnregisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId);
26 OffscreenCanvasSurfaceImpl* GetSurfaceInstance(cc::FrameSinkId);
27
28 private:
29 friend class OffscreenCanvasSurfaceManagerTest;
30
31 // cc::SurfaceObserver implementation.
32 // TODO(crbug.com/662498): Implement these functions when
33 // OffscreenCanvasSurfaceManager must propagate the resizing information
34 // back to renderer/main.
35 void OnSurfaceCreated(const cc::SurfaceId& surface_id,
36 const gfx::Size& frame_size,
37 float device_scale_factor) override {}
38 void OnSurfaceDamaged(const cc::SurfaceId&, bool* changed) override {}
39
40 // When an OffscreenCanvasSurfaceImpl instance is destructed, it will
41 // unregister the corresponding entry from this map.
42 std::unordered_map<cc::FrameSinkId,
43 OffscreenCanvasSurfaceImpl*,
44 cc::FrameSinkIdHash>
45 registered_surface_instances_;
46 DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceManager);
47 };
48
49 } // namespace content
50
51 #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698