gfx/gl/GLContextWGL.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 GLCONTEXTWGL_H_
     8 #define GLCONTEXTWGL_H_
    10 #include "GLContext.h"
    11 #include "WGLLibrary.h"
    13 namespace mozilla {
    14 namespace gl {
    16 class GLContextWGL : public GLContext
    17 {
    18 public:
    19     MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL)
    20     // From Window: (possibly for offscreen!)
    21     GLContextWGL(const SurfaceCaps& caps,
    22                  GLContext* sharedContext,
    23                  bool isOffscreen,
    24                  HDC aDC,
    25                  HGLRC aContext,
    26                  HWND aWindow = nullptr);
    28     // From PBuffer
    29     GLContextWGL(const SurfaceCaps& caps,
    30                  GLContext* sharedContext,
    31                  bool isOffscreen,
    32                  HANDLE aPbuffer,
    33                  HDC aDC,
    34                  HGLRC aContext,
    35                  int aPixelFormat);
    37     ~GLContextWGL();
    39     virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; }
    41     static GLContextWGL* Cast(GLContext* gl) {
    42         MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
    43         return static_cast<GLContextWGL*>(gl);
    44     }
    46     bool Init() MOZ_OVERRIDE;
    48     virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
    50     virtual bool IsCurrent() MOZ_OVERRIDE;
    52     void SetIsDoubleBuffered(bool aIsDB);
    54     virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
    56     virtual bool SupportsRobustness() const MOZ_OVERRIDE;
    58     virtual bool SwapBuffers() MOZ_OVERRIDE;
    60     virtual bool SetupLookupFunction() MOZ_OVERRIDE;
    62     HGLRC Context() { return mContext; }
    64 protected:
    65     friend class GLContextProviderWGL;
    67     HDC mDC;
    68     HGLRC mContext;
    69     HWND mWnd;
    70     HANDLE mPBuffer;
    71     int mPixelFormat;
    72     bool mIsDoubleBuffered;
    73 };
    75 }
    76 }
    78 #endif // GLCONTEXTWGL_H_

mercurial