summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/compositing_iosurface_context_mac.h
diff options
context:
space:
mode:
authorccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 23:45:16 +0000
committerccameron@chromium.org <ccameron@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 23:45:16 +0000
commitf78ac522f8fc1463797b4de6831f9f0ee58566f8 (patch)
treeb683be43f4ce2aa22198e2ede71497bb41265ec6 /content/browser/renderer_host/compositing_iosurface_context_mac.h
parent2f19a0632eb3212d3b230f5de41ae2004e15056c (diff)
downloadchromium_src-f78ac522f8fc1463797b4de6831f9f0ee58566f8.zip
chromium_src-f78ac522f8fc1463797b4de6831f9f0ee58566f8.tar.gz
chromium_src-f78ac522f8fc1463797b4de6831f9f0ee58566f8.tar.bz2
Separate CompositingIOSurface from its GL context
This is towards making all CompositingIOSurfaces in a window to share a single GL context. BUG=180463 Review URL: https://chromiumcodereview.appspot.com/13363002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/compositing_iosurface_context_mac.h')
-rw-r--r--content/browser/renderer_host/compositing_iosurface_context_mac.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/content/browser/renderer_host/compositing_iosurface_context_mac.h b/content/browser/renderer_host/compositing_iosurface_context_mac.h
new file mode 100644
index 0000000..bf4dd56
--- /dev/null
+++ b/content/browser/renderer_host/compositing_iosurface_context_mac.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 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.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_
+#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_
+
+#import <AppKit/NSOpenGL.h>
+#include <OpenGL/OpenGL.h>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_nsobject.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/renderer_host/compositing_iosurface_mac.h"
+
+namespace content {
+
+class CompositingIOSurfaceShaderPrograms;
+
+class CompositingIOSurfaceContext
+ : public base::RefCounted<CompositingIOSurfaceContext> {
+ public:
+ static scoped_refptr<CompositingIOSurfaceContext> Get(
+ CompositingIOSurfaceMac::SurfaceOrder surface_order);
+
+ CompositingIOSurfaceShaderPrograms* shader_program_cache() const {
+ return shader_program_cache_.get();
+ }
+ NSOpenGLContext* nsgl_context() const { return nsgl_context_; }
+ CGLContextObj cgl_context() const { return cgl_context_; }
+ bool is_vsync_disabled() const { return is_vsync_disabled_; }
+
+ private:
+ friend class base::RefCounted<CompositingIOSurfaceContext>;
+
+ CompositingIOSurfaceContext(
+ CompositingIOSurfaceMac::SurfaceOrder surface_order,
+ NSOpenGLContext* nsgl_context,
+ CGLContextObj clg_context,
+ bool is_vsync_disabled_,
+ scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache);
+ ~CompositingIOSurfaceContext();
+
+ // The value for NSOpenGLCPSurfaceOrder for this GL context, 1 will
+ // render above the window and -1 will render below the window.
+ GLint surface_order_;
+ scoped_nsobject<NSOpenGLContext> nsgl_context_;
+ CGLContextObj cgl_context_; // weak, backed by |nsgl_context_|
+ bool is_vsync_disabled_;
+ scoped_ptr<CompositingIOSurfaceShaderPrograms> shader_program_cache_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_