gfx/skia/trunk/src/gpu/GrGeometryBuffer.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.

     2 /*
     3  * Copyright 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef GrGeometryBuffer_DEFINED
    11 #define GrGeometryBuffer_DEFINED
    13 #include "GrResource.h"
    15 class GrGpu;
    17 /**
    18  * Parent class for vertex and index buffers
    19  */
    20 class GrGeometryBuffer : public GrResource {
    21 public:
    22     SK_DECLARE_INST_COUNT(GrGeometryBuffer);
    24     /**
    25      *Retrieves whether the buffer was created with the dynamic flag
    26      *
    27      * @return true if the buffer was created with the dynamic flag
    28      */
    29     bool dynamic() const { return fDynamic; }
    31     /**
    32      * Returns true if the buffer is a wrapper around a CPU array. If true it
    33      * indicates that lock will always succeed and will be free.
    34      */
    35     bool isCPUBacked() const { return fCPUBacked; }
    37     /**
    38      * Locks the buffer to be written by the CPU.
    39      *
    40      * The previous content of the buffer is invalidated. It is an error
    41      * to draw from the buffer while it is locked. It is an error to call lock
    42      * on an already locked buffer. It may fail if the backend doesn't support
    43      * locking the buffer. If the buffer is CPU backed then it will always
    44      * succeed and is a free operation. Must be matched by an unlock() call.
    45      * Currently only one lock at a time is supported (no nesting of
    46      * lock/unlock).
    47      *
    48      * @return a pointer to the data or NULL if the lock fails.
    49      */
    50     virtual void* lock() = 0;
    52     /**
    53      * Returns the same ptr that lock() returned at time of lock or NULL if the
    54      * is not locked.
    55      *
    56      * @return ptr to locked buffer data or undefined if buffer is not locked.
    57      */
    58     virtual void* lockPtr() const = 0;
    60     /**
    61      * Unlocks the buffer.
    62      *
    63      * The pointer returned by the previous lock call will no longer be valid.
    64      */
    65     virtual void unlock() = 0;
    67     /**
    68      Queries whether the buffer has been locked.
    70      @return true if the buffer is locked, false otherwise.
    71      */
    72     virtual bool isLocked() const = 0;
    74     /**
    75      * Updates the buffer data.
    76      *
    77      * The size of the buffer will be preserved. The src data will be
    78      * placed at the beginning of the buffer and any remaining contents will
    79      * be undefined.
    80      *
    81      * @return returns true if the update succeeds, false otherwise.
    82      */
    83     virtual bool updateData(const void* src, size_t srcSizeInBytes) = 0;
    85     // GrResource overrides
    86     virtual size_t sizeInBytes() const { return fSizeInBytes; }
    88 protected:
    89     GrGeometryBuffer(GrGpu* gpu, bool isWrapped, size_t sizeInBytes, bool dynamic, bool cpuBacked)
    90         : INHERITED(gpu, isWrapped)
    91         , fSizeInBytes(sizeInBytes)
    92         , fDynamic(dynamic)
    93         , fCPUBacked(cpuBacked) {}
    95 private:
    96     size_t   fSizeInBytes;
    97     bool     fDynamic;
    98     bool     fCPUBacked;
   100     typedef GrResource INHERITED;
   101 };
   103 #endif

mercurial