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

Unified Diff: content/browser/compositor/io_surface_context_mac.h

Issue 627003002: Use a single CGLContextObj to draw and update the IOSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/compositor/io_surface_context_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/io_surface_context_mac.h
diff --git a/content/browser/compositor/io_surface_context_mac.h b/content/browser/compositor/io_surface_context_mac.h
index 2654711668b37028e1581a7fde60af4dc8d5ee62..04500e15dae94b59af891d75300f9deb9564c5b4 100644
--- a/content/browser/compositor/io_surface_context_mac.h
+++ b/content/browser/compositor/io_surface_context_mac.h
@@ -18,22 +18,16 @@
namespace content {
+// The CGL context used to update and draw an IOSurface-backed texture. If an
+// error occurs on this context, or if the current GPU changes, then the
+// context is poisoned, and a new one is created.
class IOSurfaceContext
: public base::RefCounted<IOSurfaceContext>,
public content::GpuDataManagerObserver {
public:
- enum Type {
- // The number used to look up the context used for async readback and for
- // initializing the IOSurface.
- kOffscreenContext = -2,
- // The number used to look up the context used by CAOpenGLLayers.
- kCALayerContext = -3,
- };
-
- // Get or create a GL context of the specified type. Share these GL contexts
- // as much as possible because creating and destroying them can be expensive.
- // http://crbug.com/180463
- static scoped_refptr<IOSurfaceContext> Get(Type type);
+ // Get or create a GL context. Share these GL contexts as much as possible
+ // because creating and destroying them can be expensive.
+ static scoped_refptr<IOSurfaceContext> Get();
// Mark that all the GL contexts in the same sharegroup as this context as
// invalid, so they shouldn't be returned anymore by Get, but rather, new
@@ -50,21 +44,14 @@ class IOSurfaceContext
private:
friend class base::RefCounted<IOSurfaceContext>;
- IOSurfaceContext(
- Type type,
- base::ScopedTypeRef<CGLContextObj> clg_context_strong);
+ IOSurfaceContext(base::ScopedTypeRef<CGLContextObj> clg_context_strong);
virtual ~IOSurfaceContext();
- Type type_;
base::ScopedTypeRef<CGLContextObj> cgl_context_;
-
bool poisoned_;
- // The global map from window number and window ordering to
- // context data.
- typedef std::map<Type, IOSurfaceContext*> TypeMap;
- static base::LazyInstance<TypeMap> type_map_;
- static TypeMap* type_map();
+ // The current non-poisoned context, shared by all layers.
+ static IOSurfaceContext* current_context_;
};
} // namespace content
« no previous file with comments | « no previous file | content/browser/compositor/io_surface_context_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698