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

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

Issue 647553002: Revert of Use a single CGLContextObj to draw and update the IOSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 04500e15dae94b59af891d75300f9deb9564c5b4..2654711668b37028e1581a7fde60af4dc8d5ee62 100644
--- a/content/browser/compositor/io_surface_context_mac.h
+++ b/content/browser/compositor/io_surface_context_mac.h
@@ -18,16 +18,22 @@
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:
- // 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();
+ 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);
// 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
@@ -44,14 +50,21 @@
private:
friend class base::RefCounted<IOSurfaceContext>;
- IOSurfaceContext(base::ScopedTypeRef<CGLContextObj> clg_context_strong);
+ IOSurfaceContext(
+ Type type,
+ base::ScopedTypeRef<CGLContextObj> clg_context_strong);
virtual ~IOSurfaceContext();
+ Type type_;
base::ScopedTypeRef<CGLContextObj> cgl_context_;
+
bool poisoned_;
- // The current non-poisoned context, shared by all layers.
- static IOSurfaceContext* current_context_;
+ // 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();
};
} // 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