gfx/gl/GLContextCGL.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef GLCONTEXTCGL_H_
     8 #define GLCONTEXTCGL_H_
    10 #include "GLContext.h"
    12 #include "OpenGL/OpenGL.h"
    14 #ifdef __OBJC__
    15 #include <AppKit/NSOpenGL.h>
    16 #else
    17 typedef void NSOpenGLContext;
    18 #endif
    20 namespace mozilla {
    21 namespace gl {
    23 class GLContextCGL : public GLContext
    24 {
    25     friend class GLContextProviderCGL;
    27     NSOpenGLContext *mContext;
    29 public:
    30     MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextCGL)
    31     GLContextCGL(const SurfaceCaps& caps,
    32                  GLContext *shareContext,
    33                  NSOpenGLContext *context,
    34                  bool isOffscreen = false);
    36     ~GLContextCGL();
    38     virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::CGL; }
    40     static GLContextCGL* Cast(GLContext* gl) {
    41         MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL);
    42         return static_cast<GLContextCGL*>(gl);
    43     }
    45     bool Init() MOZ_OVERRIDE;
    47     NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
    48     CGLContextObj GetCGLContext() const;
    50     virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
    52     virtual bool IsCurrent() MOZ_OVERRIDE;
    54     virtual GLenum GetPreferredARGB32Format() const MOZ_OVERRIDE;
    56     virtual bool SetupLookupFunction() MOZ_OVERRIDE;
    58     virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
    60     virtual bool SupportsRobustness() const MOZ_OVERRIDE;
    62     virtual bool SwapBuffers() MOZ_OVERRIDE;
    63 };
    65 }
    66 }
    68 #endif // GLCONTEXTCGL_H_

mercurial