gfx/skia/trunk/src/gpu/gl/GrGLBufferImpl.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7
michael@0 8 #ifndef GrGLBufferImpl_DEFINED
michael@0 9 #define GrGLBufferImpl_DEFINED
michael@0 10
michael@0 11 #include "SkTypes.h"
michael@0 12 #include "gl/GrGLFunctions.h"
michael@0 13
michael@0 14 class GrGpuGL;
michael@0 15
michael@0 16 /**
michael@0 17 * This class serves as the implementation of GrGL*Buffer classes. It was written to avoid code
michael@0 18 * duplication in those classes.
michael@0 19 */
michael@0 20 class GrGLBufferImpl : public SkNoncopyable {
michael@0 21 public:
michael@0 22 struct Desc {
michael@0 23 bool fIsWrapped;
michael@0 24 GrGLuint fID; // set to 0 to indicate buffer is CPU-backed and not a VBO.
michael@0 25 size_t fSizeInBytes;
michael@0 26 bool fDynamic;
michael@0 27 };
michael@0 28
michael@0 29 GrGLBufferImpl(GrGpuGL*, const Desc&, GrGLenum bufferType);
michael@0 30 ~GrGLBufferImpl() {
michael@0 31 // either release or abandon should have been called by the owner of this object.
michael@0 32 SkASSERT(0 == fDesc.fID);
michael@0 33 }
michael@0 34
michael@0 35 void abandon();
michael@0 36 void release(GrGpuGL* gpu);
michael@0 37
michael@0 38 GrGLuint bufferID() const { return fDesc.fID; }
michael@0 39 size_t baseOffset() const { return reinterpret_cast<size_t>(fCPUData); }
michael@0 40
michael@0 41 void bind(GrGpuGL* gpu) const;
michael@0 42
michael@0 43 void* lock(GrGpuGL* gpu);
michael@0 44 void* lockPtr() const { return fLockPtr; }
michael@0 45 void unlock(GrGpuGL* gpu);
michael@0 46 bool isLocked() const;
michael@0 47 bool updateData(GrGpuGL* gpu, const void* src, size_t srcSizeInBytes);
michael@0 48
michael@0 49 private:
michael@0 50 void validate() const;
michael@0 51
michael@0 52 Desc fDesc;
michael@0 53 GrGLenum fBufferType; // GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER
michael@0 54 void* fCPUData;
michael@0 55 void* fLockPtr;
michael@0 56
michael@0 57 typedef SkNoncopyable INHERITED;
michael@0 58 };
michael@0 59
michael@0 60 #endif

mercurial