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.
1 /*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #ifndef GrPathRendererChain_DEFINED
9 #define GrPathRendererChain_DEFINED
11 #include "SkRefCnt.h"
12 #include "SkTArray.h"
14 class GrContext;
15 class GrDrawTarget;
16 class GrPathRenderer;
17 class SkPath;
18 class SkStrokeRec;
20 /**
21 * Keeps track of an ordered list of path renderers. When a path needs to be
22 * drawn this list is scanned to find the most preferred renderer. To add your
23 * path renderer to the list implement the GrPathRenderer::AddPathRenderers
24 * function.
25 */
26 class GrPathRendererChain : public SkRefCnt {
27 public:
28 // See comments in GrPathRenderer.h
29 enum StencilSupport {
30 kNoSupport_StencilSupport,
31 kStencilOnly_StencilSupport,
32 kNoRestriction_StencilSupport,
33 };
35 SK_DECLARE_INST_COUNT(GrPathRendererChain)
37 GrPathRendererChain(GrContext* context);
39 ~GrPathRendererChain();
41 // takes a ref and unrefs in destructor
42 GrPathRenderer* addPathRenderer(GrPathRenderer* pr);
44 /** Documents how the caller plans to use a GrPathRenderer to draw a path. It affects the PR
45 returned by getPathRenderer */
46 enum DrawType {
47 kColor_DrawType, // draw to the color buffer, no AA
48 kColorAntiAlias_DrawType, // draw to color buffer, with partial coverage AA
49 kStencilOnly_DrawType, // draw just to the stencil buffer
50 kStencilAndColor_DrawType, // draw the stencil and color buffer, no AA
51 kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer, with partial
52 // coverage AA.
53 };
54 /** Returns a GrPathRenderer compatible with the request if one is available. If the caller
55 is drawing the path to the stencil buffer then stencilSupport can be used to determine
56 whether the path can be rendered with arbitrary stencil rules or not. See comments on
57 StencilSupport in GrPathRenderer.h. */
58 GrPathRenderer* getPathRenderer(const SkPath& path,
59 const SkStrokeRec& rec,
60 const GrDrawTarget* target,
61 DrawType drawType,
62 StencilSupport* stencilSupport);
64 private:
65 GrPathRendererChain();
67 void init();
69 enum {
70 kPreAllocCount = 8,
71 };
72 bool fInit;
73 GrContext* fOwner;
74 SkSTArray<kPreAllocCount, GrPathRenderer*, true> fChain;
76 typedef SkRefCnt INHERITED;
77 };
79 #endif