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 SkPDFShader_DEFINED
11 #define SkPDFShader_DEFINED
13 #include "SkPDFStream.h"
14 #include "SkPDFTypes.h"
15 #include "SkMatrix.h"
16 #include "SkRefCnt.h"
17 #include "SkShader.h"
19 class SkObjRef;
20 class SkPDFCatalog;
22 /** \class SkPDFShader
24 In PDF parlance, this is a pattern, used in place of a color when the
25 pattern color space is selected.
26 */
28 class SkPDFShader {
29 public:
30 /** Get the PDF shader for the passed SkShader. If the SkShader is
31 * invalid in some way, returns NULL. The reference count of
32 * the object is incremented and it is the caller's responsibility to
33 * unreference it when done. This is needed to accommodate the weak
34 * reference pattern used when the returned object is new and has no
35 * other references.
36 * @param shader The SkShader to emulate.
37 * @param matrix The current transform. (PDF shaders are absolutely
38 * positioned, relative to where the page is drawn.)
39 * @param surfceBBox The bounding box of the drawing surface (with matrix
40 * already applied).
41 */
42 static SkPDFObject* GetPDFShader(const SkShader& shader,
43 const SkMatrix& matrix,
44 const SkIRect& surfaceBBox);
46 protected:
47 class State;
49 class ShaderCanonicalEntry {
50 public:
51 ShaderCanonicalEntry(SkPDFObject* pdfShader, const State* state);
52 bool operator==(const ShaderCanonicalEntry& b) const;
54 SkPDFObject* fPDFShader;
55 const State* fState;
56 };
57 // This should be made a hash table if performance is a problem.
58 static SkTDArray<ShaderCanonicalEntry>& CanonicalShaders();
59 static SkBaseMutex& CanonicalShadersMutex();
61 // This is an internal method.
62 // CanonicalShadersMutex() should already be acquired.
63 // This also takes ownership of shaderState.
64 static SkPDFObject* GetPDFShaderByState(State* shaderState);
65 static void RemoveShader(SkPDFObject* shader);
67 SkPDFShader();
68 virtual ~SkPDFShader() {};
70 virtual bool isValid() = 0;
71 };
73 #endif