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

Unified Diff: ui/gl/gl_context_virtual.cc

Issue 11275120: Virtual GL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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_context_virtual.cc
diff --git a/ui/gl/gl_context_virtual.cc b/ui/gl/gl_context_virtual.cc
new file mode 100644
index 0000000000000000000000000000000000000000..24e7f6ab894f6fbd19142f13d5a22fe916b92973
--- /dev/null
+++ b/ui/gl/gl_context_virtual.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gl/gl_context_virtual.h"
+
+#include "ui/gl/gl_surface.h"
+
+namespace gfx {
+
+GLContextVirtual::GLContextVirtual(
+ GLShareGroup* share_group,
+ GLContext* shared_context,
+ const gpu::gles2::GLES2Decoder* decoder)
+ : GLContext(share_group),
+ shared_context_(shared_context),
+ display_(NULL),
+ decoder_(decoder) {
+ shared_context_->SetupForVirtualization();
+}
+
+Display* GLContextVirtual::display() {
+ return display_;
+}
+
+bool GLContextVirtual::Initialize(
+ GLSurface* compatible_surface, GpuPreference gpu_preference) {
+ display_ = static_cast<Display*>(compatible_surface->GetDisplay());
+
+ return true;
+}
+
+void GLContextVirtual::Destroy() {
+ //if (context_) {
+ // context_ = NULL;
+ //}
+}
+
+bool GLContextVirtual::MakeCurrent(GLSurface* surface) {
+ shared_context_->MakeVirtuallyCurrent(this, surface);
+ return true;
+}
+
+void GLContextVirtual::ReleaseCurrent(GLSurface* surface) {
+ shared_context_ = NULL;
+ display_ = NULL;
+}
+
+bool GLContextVirtual::IsCurrent(GLSurface* surface) {
+ return true;
+}
+
+void* GLContextVirtual::GetHandle() {
+ return NULL; //return context_;
+}
+
+const gpu::gles2::GLES2Decoder* GLContextVirtual::GetDecoder() {
+ return decoder_;
+}
+
+void GLContextVirtual::SetSwapInterval(int interval) {
+ shared_context_->SetSwapInterval(interval);
+}
+
+std::string GLContextVirtual::GetExtensions() {
+ return shared_context_->GetExtensions();
+}
+
+bool GLContextVirtual::GetTotalGpuMemory(size_t* bytes) {
+ return shared_context_->GetTotalGpuMemory(bytes);
+}
+
+bool GLContextVirtual::WasAllocatedUsingRobustnessExtension() {
+ return shared_context_->WasAllocatedUsingRobustnessExtension();
+}
+
+GLContextVirtual::~GLContextVirtual() {
+ Destroy();
+}
+
+} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698