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 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2011 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #include "GrStencilBuffer.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "GrContext.h" |
michael@0 | 12 | #include "GrGpu.h" |
michael@0 | 13 | #include "GrResourceCache.h" |
michael@0 | 14 | |
michael@0 | 15 | void GrStencilBuffer::transferToCache() { |
michael@0 | 16 | SkASSERT(NULL == this->getCacheEntry()); |
michael@0 | 17 | |
michael@0 | 18 | this->getGpu()->getContext()->addStencilBuffer(this); |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | namespace { |
michael@0 | 22 | // we should never have more than one stencil buffer with same combo of (width,height,samplecount) |
michael@0 | 23 | void gen_cache_id(int width, int height, int sampleCnt, GrCacheID* cacheID) { |
michael@0 | 24 | static const GrCacheID::Domain gStencilBufferDomain = GrCacheID::GenerateDomain(); |
michael@0 | 25 | GrCacheID::Key key; |
michael@0 | 26 | uint32_t* keyData = key.fData32; |
michael@0 | 27 | keyData[0] = width; |
michael@0 | 28 | keyData[1] = height; |
michael@0 | 29 | keyData[2] = sampleCnt; |
michael@0 | 30 | memset(keyData + 3, 0, sizeof(key) - 3 * sizeof(uint32_t)); |
michael@0 | 31 | GR_STATIC_ASSERT(sizeof(key) >= 3 * sizeof(uint32_t)); |
michael@0 | 32 | cacheID->reset(gStencilBufferDomain, key); |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | GrResourceKey GrStencilBuffer::ComputeKey(int width, |
michael@0 | 37 | int height, |
michael@0 | 38 | int sampleCnt) { |
michael@0 | 39 | // All SBs are created internally to attach to RTs so they all use the same domain. |
michael@0 | 40 | static const GrResourceKey::ResourceType gStencilBufferResourceType = |
michael@0 | 41 | GrResourceKey::GenerateResourceType(); |
michael@0 | 42 | GrCacheID id; |
michael@0 | 43 | gen_cache_id(width, height, sampleCnt, &id); |
michael@0 | 44 | |
michael@0 | 45 | // we don't use any flags for SBs currently. |
michael@0 | 46 | return GrResourceKey(id, gStencilBufferResourceType, 0); |
michael@0 | 47 | } |