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

Unified Diff: ui/gl/gl_context.cc

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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_context.h ('k') | ui/gl/gl_enums_implementation_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context.cc
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc
index dd8aa266f5081559b0189a8a6a41fb76736e5f98..e64d031351560ef4c1324e640033fc25df329a1b 100644
--- a/ui/gl/gl_context.cc
+++ b/ui/gl/gl_context.cc
@@ -4,6 +4,8 @@
#include <string>
+#include "base/bind.h"
+#include "base/cancelable_callback.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
@@ -41,8 +43,15 @@ void GLContext::ScopedReleaseCurrent::Cancel() {
GLContext::GLContext(GLShareGroup* share_group) :
share_group_(share_group),
+ state_dirtied_externally_(false),
swap_interval_(1),
- force_swap_interval_zero_(false) {
+ force_swap_interval_zero_(false),
+ state_dirtied_callback_(
+ base::Bind(&GLContext::SetStateWasDirtiedExternally,
+ // Note that if this is not unretained, it will create a cycle (and
+ // will never be freed.
+ base::Unretained(this),
+ true)) {
if (!share_group_.get())
share_group_ = new GLShareGroup;
@@ -93,6 +102,24 @@ std::string GLContext::GetGLRenderer() {
return std::string(renderer ? renderer : "");
}
+base::Closure GLContext::GetStateWasDirtiedExternallyCallback() {
+ return state_dirtied_callback_.callback();
+}
+
+void GLContext::RestoreStateIfDirtiedExternally() {
+ NOTREACHED();
+}
+
+bool GLContext::GetStateWasDirtiedExternally() const {
+ DCHECK(virtual_gl_api_);
+ return state_dirtied_externally_;
+}
+
+void GLContext::SetStateWasDirtiedExternally(bool dirtied_externally) {
+ DCHECK(virtual_gl_api_);
+ state_dirtied_externally_ = dirtied_externally;
+}
+
bool GLContext::HasExtension(const char* name) {
std::string extensions = GetExtensions();
extensions += " ";
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_enums_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698