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.
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 GrStencilBuffer_DEFINED
11 #define GrStencilBuffer_DEFINED
13 #include "GrClipData.h"
14 #include "GrResource.h"
16 class GrRenderTarget;
17 class GrResourceEntry;
18 class GrResourceKey;
20 class GrStencilBuffer : public GrResource {
21 public:
22 SK_DECLARE_INST_COUNT(GrStencilBuffer);
24 virtual ~GrStencilBuffer() {
25 // TODO: allow SB to be purged and detach itself from rts
26 }
28 int width() const { return fWidth; }
29 int height() const { return fHeight; }
30 int bits() const { return fBits; }
31 int numSamples() const { return fSampleCnt; }
33 // called to note the last clip drawn to this buffer.
34 void setLastClip(int32_t clipStackGenID,
35 const SkIRect& clipSpaceRect,
36 const SkIPoint clipSpaceToStencilOffset) {
37 fLastClipStackGenID = clipStackGenID;
38 fLastClipStackRect = clipSpaceRect;
39 fLastClipSpaceOffset = clipSpaceToStencilOffset;
40 }
42 // called to determine if we have to render the clip into SB.
43 bool mustRenderClip(int32_t clipStackGenID,
44 const SkIRect& clipSpaceRect,
45 const SkIPoint clipSpaceToStencilOffset) const {
46 return fLastClipStackGenID != clipStackGenID ||
47 fLastClipSpaceOffset != clipSpaceToStencilOffset ||
48 !fLastClipStackRect.contains(clipSpaceRect);
49 }
51 // Places the sb in the cache. The cache takes a ref of the stencil buffer.
52 void transferToCache();
54 static GrResourceKey ComputeKey(int width, int height, int sampleCnt);
56 protected:
57 GrStencilBuffer(GrGpu* gpu, bool isWrapped, int width, int height, int bits, int sampleCnt)
58 : GrResource(gpu, isWrapped)
59 , fWidth(width)
60 , fHeight(height)
61 , fBits(bits)
62 , fSampleCnt(sampleCnt)
63 , fLastClipStackGenID(SkClipStack::kInvalidGenID) {
64 fLastClipStackRect.setEmpty();
65 }
67 private:
69 int fWidth;
70 int fHeight;
71 int fBits;
72 int fSampleCnt;
74 int32_t fLastClipStackGenID;
75 SkIRect fLastClipStackRect;
76 SkIPoint fLastClipSpaceOffset;
78 typedef GrResource INHERITED;
79 };
81 #endif