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

Unified Diff: ui/gl/gl_share_group.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: auto* Created 4 years, 3 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 | « ui/gl/gl_share_group.h ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_share_group.cc
diff --git a/ui/gl/gl_share_group.cc b/ui/gl/gl_share_group.cc
index 82fc7594f4dd4ff0090593312e133e3b2837b1ef..94708c09202ef8bb8474de3e04e49998710900fc 100644
--- a/ui/gl/gl_share_group.cc
+++ b/ui/gl/gl_share_group.cc
@@ -7,15 +7,16 @@
#include "base/logging.h"
#include "build/build_config.h"
#include "ui/gl/gl_context.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface.h"
namespace gl {
GLShareGroup::GLShareGroup()
- : shared_context_(NULL)
#if defined(OS_MACOSX)
- , renderer_id_(-1)
+ : renderer_id_(-1)
#endif
- {
+{
}
void GLShareGroup::AddContext(GLContext* context) {
@@ -24,8 +25,12 @@ void GLShareGroup::AddContext(GLContext* context) {
void GLShareGroup::RemoveContext(GLContext* context) {
contexts_.erase(context);
- if (shared_context_ == context)
- shared_context_ = NULL;
+ for (const auto& pair : shared_contexts_) {
+ if (pair.second == context) {
+ shared_contexts_.erase(pair.first);
+ return;
+ }
+ }
}
void* GLShareGroup::GetHandle() {
@@ -47,13 +52,17 @@ GLContext* GLShareGroup::GetContext() {
return NULL;
}
-void GLShareGroup::SetSharedContext(GLContext* context) {
+void GLShareGroup::SetSharedContext(GLSurface* compatible, GLContext* context) {
DCHECK(contexts_.find(context) != contexts_.end());
- shared_context_ = context;
+ shared_contexts_[compatible->GetCompatibilityKey()] = context;
}
-GLContext* GLShareGroup::GetSharedContext() {
- return shared_context_;
+GLContext* GLShareGroup::GetSharedContext(GLSurface* compatible) {
+ unsigned long compatibility_key = compatible->GetCompatibilityKey();
+ auto it = shared_contexts_.find(compatibility_key);
+ if (it == shared_contexts_.end())
+ return nullptr;
+ return it->second;
}
#if defined(OS_MACOSX)
« no previous file with comments | « ui/gl/gl_share_group.h ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698