gfx/angle/src/libGLESv2/renderer/BufferStorage9.cpp

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.

     1 #include "precompiled.h"
     2 //
     3 // Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
     4 // Use of this source code is governed by a BSD-style license that can be
     5 // found in the LICENSE file.
     6 //
     8 // BufferStorage9.cpp Defines the BufferStorage9 class.
    10 #include "libGLESv2/renderer/BufferStorage9.h"
    11 #include "common/debug.h"
    13 namespace rx
    14 {
    16 BufferStorage9::BufferStorage9()
    17 {
    18     mMemory = NULL;
    19     mAllocatedSize = 0;
    20     mSize = 0;
    21 }
    23 BufferStorage9::~BufferStorage9()
    24 {
    25     delete[] mMemory;
    26 }
    28 BufferStorage9 *BufferStorage9::makeBufferStorage9(BufferStorage *bufferStorage)
    29 {
    30     ASSERT(HAS_DYNAMIC_TYPE(BufferStorage9*, bufferStorage));
    31     return static_cast<BufferStorage9*>(bufferStorage);
    32 }
    34 void *BufferStorage9::getData()
    35 {
    36     return mMemory;
    37 }
    39 void BufferStorage9::setData(const void* data, unsigned int size, unsigned int offset)
    40 {
    41     if (!mMemory || offset + size > mAllocatedSize)
    42     {
    43         unsigned int newAllocatedSize = offset + size;
    44         void *newMemory = new char[newAllocatedSize];
    46         if (offset > 0 && mMemory && mAllocatedSize > 0)
    47         {
    48             memcpy(newMemory, mMemory, std::min(offset, mAllocatedSize));
    49         }
    51         delete[] mMemory;
    52         mMemory = newMemory;
    53         mAllocatedSize = newAllocatedSize;
    54     }
    56     mSize = std::max(mSize, offset + size);
    57     if (data)
    58     {
    59         memcpy(reinterpret_cast<char*>(mMemory) + offset, data, size);
    60     }
    61 }
    63 void BufferStorage9::clear()
    64 {
    65     mSize = 0;
    66 }
    68 unsigned int BufferStorage9::getSize() const
    69 {
    70     return mSize;
    71 }
    73 bool BufferStorage9::supportsDirectBinding() const
    74 {
    75     return false;
    76 }
    78 }

mercurial