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

Side by Side Diff: content/browser/gpu/gpu_surface_tracker.h

Issue 2190033002: content: Add ContextProviderFactory to create a render ContextProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 4 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_GPU_GPU_SURFACE_TRACKER_H_ 5 #ifndef CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ 6 #define CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 30 matching lines...) Expand all
41 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
42 gl::ScopedJavaSurface AcquireJavaSurface(int surface_id) override; 42 gl::ScopedJavaSurface AcquireJavaSurface(int surface_id) override;
43 #endif 43 #endif
44 44
45 // Gets the global instance of the surface tracker. 45 // Gets the global instance of the surface tracker.
46 static GpuSurfaceTracker* Get() { return GetInstance(); } 46 static GpuSurfaceTracker* Get() { return GetInstance(); }
47 47
48 // Adds a surface for a native widget. Returns the surface ID. 48 // Adds a surface for a native widget. Returns the surface ID.
49 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget); 49 int AddSurfaceForNativeWidget(gfx::AcceleratedWidget widget);
50 50
51 // Return the surface for a native widget. Returns null if the widget is not
52 // found.
53 gpu::SurfaceHandle GetSurfaceForNativeWidget(gfx::AcceleratedWidget);
54
51 // Removes a given existing surface. 55 // Removes a given existing surface.
52 void RemoveSurface(gpu::SurfaceHandle surface_handle); 56 void RemoveSurface(gpu::SurfaceHandle surface_handle);
53 57
54 // Returns the number of surfaces currently registered with the tracker. 58 // Returns the number of surfaces currently registered with the tracker.
55 std::size_t GetSurfaceCount(); 59 std::size_t GetSurfaceCount();
56 60
57 // Gets the global instance of the surface tracker. Identical to Get(), but 61 // Gets the global instance of the surface tracker. Identical to Get(), but
58 // named that way for the implementation of Singleton. 62 // named that way for the implementation of Singleton.
59 static GpuSurfaceTracker* GetInstance(); 63 static GpuSurfaceTracker* GetInstance();
60 64
61 private: 65 private:
62 typedef std::map<gpu::SurfaceHandle, gfx::AcceleratedWidget> SurfaceMap; 66 typedef std::map<gpu::SurfaceHandle, gfx::AcceleratedWidget> SurfaceMap;
63 67
64 friend struct base::DefaultSingletonTraits<GpuSurfaceTracker>; 68 friend struct base::DefaultSingletonTraits<GpuSurfaceTracker>;
65 69
66 GpuSurfaceTracker(); 70 GpuSurfaceTracker();
67 ~GpuSurfaceTracker() override; 71 ~GpuSurfaceTracker() override;
68 72
69 base::Lock lock_; 73 base::Lock lock_;
70 SurfaceMap surface_map_; 74 SurfaceMap surface_map_;
71 int next_surface_handle_; 75 int next_surface_handle_;
72 76
73 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker); 77 DISALLOW_COPY_AND_ASSIGN(GpuSurfaceTracker);
74 }; 78 };
75 79
76 } // namespace content 80 } // namespace content
77 81
78 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_ 82 #endif // CONTENT_BROWSER_GPU_GPU_SURFACE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698