Sat, 03 Jan 2015 20:18:00 +0100
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 | #include "precompiled.h" |
michael@0 | 2 | // |
michael@0 | 3 | // Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. |
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 | // HandleAllocator.cpp: Implements the gl::HandleAllocator class, which is used |
michael@0 | 9 | // to allocate GL handles. |
michael@0 | 10 | |
michael@0 | 11 | #include "libGLESv2/HandleAllocator.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "libGLESv2/main.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace gl |
michael@0 | 16 | { |
michael@0 | 17 | |
michael@0 | 18 | HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1) |
michael@0 | 19 | { |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | HandleAllocator::~HandleAllocator() |
michael@0 | 23 | { |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | void HandleAllocator::setBaseHandle(GLuint value) |
michael@0 | 27 | { |
michael@0 | 28 | ASSERT(mBaseValue == mNextValue); |
michael@0 | 29 | mBaseValue = value; |
michael@0 | 30 | mNextValue = value; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | GLuint HandleAllocator::allocate() |
michael@0 | 34 | { |
michael@0 | 35 | if (mFreeValues.size()) |
michael@0 | 36 | { |
michael@0 | 37 | GLuint handle = mFreeValues.back(); |
michael@0 | 38 | mFreeValues.pop_back(); |
michael@0 | 39 | return handle; |
michael@0 | 40 | } |
michael@0 | 41 | return mNextValue++; |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | void HandleAllocator::release(GLuint handle) |
michael@0 | 45 | { |
michael@0 | 46 | if (handle == mNextValue - 1) |
michael@0 | 47 | { |
michael@0 | 48 | // Don't drop below base value |
michael@0 | 49 | if(mNextValue > mBaseValue) |
michael@0 | 50 | { |
michael@0 | 51 | mNextValue--; |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | else |
michael@0 | 55 | { |
michael@0 | 56 | // Only free handles that we own - don't drop below the base value |
michael@0 | 57 | if (handle >= mBaseValue) |
michael@0 | 58 | { |
michael@0 | 59 | mFreeValues.push_back(handle); |
michael@0 | 60 | } |
michael@0 | 61 | } |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | } |