Index: ui/gl/gl_share_group.h |
diff --git a/ui/gl/gl_share_group.h b/ui/gl/gl_share_group.h |
index 86e03c1a661163c2d4951b55f5fae9f055730ed8..f8ede97831d88d2fd3c1454930ff858ec06310fa 100644 |
--- a/ui/gl/gl_share_group.h |
+++ b/ui/gl/gl_share_group.h |
@@ -5,12 +5,16 @@ |
#ifndef UI_GL_GL_SHARE_GROUP_H_ |
#define UI_GL_GL_SHARE_GROUP_H_ |
+#include <map> |
#include <set> |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
#include "build/build_config.h" |
#include "ui/gl/gl_export.h" |
+#include "ui/gl/gl_surface.h" |
+#include "ui/gl/gpu_preference.h" |
namespace gfx { |
@@ -34,9 +38,9 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { |
// or NULL if there are no initialized contexts in the share group. |
GLContext* GetContext(); |
- // Sets and returns the unique shared GL context. Used for context |
- // virtualization. |
- void SetSharedContext(GLContext* context); |
+ // Updates the shared context pool and sets the active shared GL context |
+ // used for virtualization to match the configuration. |
+ void UpdateActiveSharedContext(GLSurface* surface, GpuPreference preference); |
GLContext* GetSharedContext(); |
#if defined(OS_MACOSX) |
@@ -56,7 +60,13 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { |
typedef std::set<GLContext*> ContextSet; |
ContextSet contexts_; |
- GLContext* shared_context_; |
+ // USe refptr for GL Contexts to keep the shared contexts temporarily not |
+ // referenced by any virtual GL context. Will be destroyed together with |
+ // the share group. |
+ scoped_ptr<std::map<GLSurface::Format, |
+ scoped_refptr<GLContext>>> shared_contexts_; |
+ GLContext* active_context_; |
+ GLSurface::Format format_; |
#if defined(OS_MACOSX) |
int renderer_id_; |