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