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 | |
michael@0 | 10 | #include "GrRenderTarget.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "GrContext.h" |
michael@0 | 13 | #include "GrGpu.h" |
michael@0 | 14 | #include "GrStencilBuffer.h" |
michael@0 | 15 | |
michael@0 | 16 | bool GrRenderTarget::readPixels(int left, int top, int width, int height, |
michael@0 | 17 | GrPixelConfig config, |
michael@0 | 18 | void* buffer, |
michael@0 | 19 | size_t rowBytes, |
michael@0 | 20 | uint32_t pixelOpsFlags) { |
michael@0 | 21 | // go through context so that all necessary flushing occurs |
michael@0 | 22 | GrContext* context = this->getContext(); |
michael@0 | 23 | if (NULL == context) { |
michael@0 | 24 | return false; |
michael@0 | 25 | } |
michael@0 | 26 | return context->readRenderTargetPixels(this, |
michael@0 | 27 | left, top, width, height, |
michael@0 | 28 | config, buffer, rowBytes, |
michael@0 | 29 | pixelOpsFlags); |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | void GrRenderTarget::writePixels(int left, int top, int width, int height, |
michael@0 | 33 | GrPixelConfig config, |
michael@0 | 34 | const void* buffer, |
michael@0 | 35 | size_t rowBytes, |
michael@0 | 36 | uint32_t pixelOpsFlags) { |
michael@0 | 37 | // go through context so that all necessary flushing occurs |
michael@0 | 38 | GrContext* context = this->getContext(); |
michael@0 | 39 | if (NULL == context) { |
michael@0 | 40 | return; |
michael@0 | 41 | } |
michael@0 | 42 | context->writeRenderTargetPixels(this, |
michael@0 | 43 | left, top, width, height, |
michael@0 | 44 | config, buffer, rowBytes, |
michael@0 | 45 | pixelOpsFlags); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | void GrRenderTarget::resolve() { |
michael@0 | 49 | // go through context so that all necessary flushing occurs |
michael@0 | 50 | GrContext* context = this->getContext(); |
michael@0 | 51 | if (NULL == context) { |
michael@0 | 52 | return; |
michael@0 | 53 | } |
michael@0 | 54 | context->resolveRenderTarget(this); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | size_t GrRenderTarget::sizeInBytes() const { |
michael@0 | 58 | size_t colorBits; |
michael@0 | 59 | if (kUnknown_GrPixelConfig == fDesc.fConfig) { |
michael@0 | 60 | colorBits = 32; // don't know, make a guess |
michael@0 | 61 | } else { |
michael@0 | 62 | colorBits = GrBytesPerPixel(fDesc.fConfig); |
michael@0 | 63 | } |
michael@0 | 64 | uint64_t size = fDesc.fWidth; |
michael@0 | 65 | size *= fDesc.fHeight; |
michael@0 | 66 | size *= colorBits; |
michael@0 | 67 | size *= GrMax(1, fDesc.fSampleCnt); |
michael@0 | 68 | return (size_t)(size / 8); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | void GrRenderTarget::flagAsNeedingResolve(const SkIRect* rect) { |
michael@0 | 72 | if (kCanResolve_ResolveType == getResolveType()) { |
michael@0 | 73 | if (NULL != rect) { |
michael@0 | 74 | fResolveRect.join(*rect); |
michael@0 | 75 | if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
michael@0 | 76 | fResolveRect.setEmpty(); |
michael@0 | 77 | } |
michael@0 | 78 | } else { |
michael@0 | 79 | fResolveRect.setLTRB(0, 0, this->width(), this->height()); |
michael@0 | 80 | } |
michael@0 | 81 | } |
michael@0 | 82 | } |
michael@0 | 83 | |
michael@0 | 84 | void GrRenderTarget::overrideResolveRect(const SkIRect rect) { |
michael@0 | 85 | fResolveRect = rect; |
michael@0 | 86 | if (fResolveRect.isEmpty()) { |
michael@0 | 87 | fResolveRect.setLargestInverted(); |
michael@0 | 88 | } else { |
michael@0 | 89 | if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { |
michael@0 | 90 | fResolveRect.setLargestInverted(); |
michael@0 | 91 | } |
michael@0 | 92 | } |
michael@0 | 93 | } |
michael@0 | 94 | |
michael@0 | 95 | void GrRenderTarget::setStencilBuffer(GrStencilBuffer* stencilBuffer) { |
michael@0 | 96 | SkRefCnt_SafeAssign(fStencilBuffer, stencilBuffer); |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | void GrRenderTarget::onRelease() { |
michael@0 | 100 | this->setStencilBuffer(NULL); |
michael@0 | 101 | |
michael@0 | 102 | INHERITED::onRelease(); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | void GrRenderTarget::onAbandon() { |
michael@0 | 106 | this->setStencilBuffer(NULL); |
michael@0 | 107 | |
michael@0 | 108 | INHERITED::onAbandon(); |
michael@0 | 109 | } |