content/canvas/src/WebGLExtensionVertexArray.cpp

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: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "WebGLContext.h"
     7 #include "WebGLBuffer.h"
     8 #include "WebGLVertexArray.h"
     9 #include "WebGLExtensions.h"
    10 #include "mozilla/dom/WebGLRenderingContextBinding.h"
    11 #include "GLContext.h"
    13 using namespace mozilla;
    15 WebGLExtensionVertexArray::WebGLExtensionVertexArray(WebGLContext* context)
    16   : WebGLExtensionBase(context)
    17 {
    18     MOZ_ASSERT(IsSupported(context), "should not construct WebGLExtensionVertexArray :"
    19                                      "OES_vertex_array_object unsuported.");
    20 }
    22 WebGLExtensionVertexArray::~WebGLExtensionVertexArray()
    23 {
    24 }
    26 already_AddRefed<WebGLVertexArray> WebGLExtensionVertexArray::CreateVertexArrayOES()
    27 {
    28     if (mIsLost) {
    29         mContext->ErrorInvalidOperation("createVertexArrayOES: Extension is lost. Returning NULL.");
    30         return nullptr;
    31     }
    33     return mContext->CreateVertexArray();
    34 }
    36 void WebGLExtensionVertexArray::DeleteVertexArrayOES(WebGLVertexArray* array)
    37 {
    38     if (mIsLost)
    39         return mContext->ErrorInvalidOperation("deleteVertexArrayOES: Extension is lost.");
    41     mContext->DeleteVertexArray(array);
    42 }
    44 bool WebGLExtensionVertexArray::IsVertexArrayOES(WebGLVertexArray* array)
    45 {
    46     if (mIsLost) {
    47         mContext->ErrorInvalidOperation("isVertexArrayOES: Extension is lost. Returning false.");
    48         return false;
    49     }
    51     return mContext->IsVertexArray(array);
    52 }
    54 void WebGLExtensionVertexArray::BindVertexArrayOES(WebGLVertexArray* array)
    55 {
    56     if (mIsLost)
    57         return mContext->ErrorInvalidOperation("bindVertexArrayOES: Extension is lost.");
    59     mContext->BindVertexArray(array);
    60 }
    62 bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context)
    63 {
    64     gl::GLContext* gl = context->GL();
    66     return gl->IsSupported(gl::GLFeature::vertex_array_object);
    67 }
    69 IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray)

mercurial