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

Unified Diff: ui/gl/gl_share_group.h

Issue 1652873002: Android: Use virtualized context only for those with compatible config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 10 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
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_;

Powered by Google App Engine
This is Rietveld 408576698