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 The Android Open Source Project |
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 SkDrawLooper_DEFINED |
michael@0 | 11 | #define SkDrawLooper_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkFlattenable.h" |
michael@0 | 14 | |
michael@0 | 15 | class SkCanvas; |
michael@0 | 16 | class SkPaint; |
michael@0 | 17 | struct SkRect; |
michael@0 | 18 | class SkString; |
michael@0 | 19 | |
michael@0 | 20 | /** \class SkDrawLooper |
michael@0 | 21 | Subclasses of SkDrawLooper can be attached to a SkPaint. Where they are, |
michael@0 | 22 | and something is drawn to a canvas with that paint, the looper subclass will |
michael@0 | 23 | be called, allowing it to modify the canvas and/or paint for that draw call. |
michael@0 | 24 | More than that, via the next() method, the looper can modify the draw to be |
michael@0 | 25 | invoked multiple times (hence the name loop-er), allow it to perform effects |
michael@0 | 26 | like shadows or frame/fills, that require more than one pass. |
michael@0 | 27 | */ |
michael@0 | 28 | class SK_API SkDrawLooper : public SkFlattenable { |
michael@0 | 29 | public: |
michael@0 | 30 | SK_DECLARE_INST_COUNT(SkDrawLooper) |
michael@0 | 31 | |
michael@0 | 32 | /** |
michael@0 | 33 | * Holds state during a draw. Users call next() until it returns false. |
michael@0 | 34 | * |
michael@0 | 35 | * Subclasses of SkDrawLooper should create a subclass of this object to |
michael@0 | 36 | * hold state specific to their subclass. |
michael@0 | 37 | */ |
michael@0 | 38 | class SK_API Context : public SkNoncopyable { |
michael@0 | 39 | public: |
michael@0 | 40 | Context() {} |
michael@0 | 41 | virtual ~Context() {} |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Called in a loop on objects returned by SkDrawLooper::createContext(). |
michael@0 | 45 | * Each time true is returned, the object is drawn (possibly with a modified |
michael@0 | 46 | * canvas and/or paint). When false is finally returned, drawing for the object |
michael@0 | 47 | * stops. |
michael@0 | 48 | * |
michael@0 | 49 | * On each call, the paint will be in its original state, but the |
michael@0 | 50 | * canvas will be as it was following the previous call to next() or |
michael@0 | 51 | * createContext(). |
michael@0 | 52 | * |
michael@0 | 53 | * The implementation must ensure that, when next() finally returns |
michael@0 | 54 | * false, the canvas has been restored to the state it was |
michael@0 | 55 | * initially, before createContext() was first called. |
michael@0 | 56 | */ |
michael@0 | 57 | virtual bool next(SkCanvas* canvas, SkPaint* paint) = 0; |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * Called right before something is being drawn. Returns a Context |
michael@0 | 62 | * whose next() method should be called until it returns false. |
michael@0 | 63 | * The caller has to ensure that the storage pointer provides enough |
michael@0 | 64 | * memory for the Context. The required size can be queried by calling |
michael@0 | 65 | * contextSize(). It is also the caller's responsibility to destroy the |
michael@0 | 66 | * object after use. |
michael@0 | 67 | */ |
michael@0 | 68 | virtual Context* createContext(SkCanvas*, void* storage) const = 0; |
michael@0 | 69 | |
michael@0 | 70 | /** |
michael@0 | 71 | * Returns the number of bytes needed to store subclasses of Context (belonging to the |
michael@0 | 72 | * corresponding SkDrawLooper subclass). |
michael@0 | 73 | */ |
michael@0 | 74 | virtual size_t contextSize() const = 0; |
michael@0 | 75 | |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * The fast bounds functions are used to enable the paint to be culled early |
michael@0 | 79 | * in the drawing pipeline. If a subclass can support this feature it must |
michael@0 | 80 | * return true for the canComputeFastBounds() function. If that function |
michael@0 | 81 | * returns false then computeFastBounds behavior is undefined otherwise it |
michael@0 | 82 | * is expected to have the following behavior. Given the parent paint and |
michael@0 | 83 | * the parent's bounding rect the subclass must fill in and return the |
michael@0 | 84 | * storage rect, where the storage rect is with the union of the src rect |
michael@0 | 85 | * and the looper's bounding rect. |
michael@0 | 86 | */ |
michael@0 | 87 | virtual bool canComputeFastBounds(const SkPaint& paint) const; |
michael@0 | 88 | virtual void computeFastBounds(const SkPaint& paint, |
michael@0 | 89 | const SkRect& src, SkRect* dst) const; |
michael@0 | 90 | |
michael@0 | 91 | SK_TO_STRING_PUREVIRT() |
michael@0 | 92 | SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper) |
michael@0 | 93 | |
michael@0 | 94 | protected: |
michael@0 | 95 | SkDrawLooper() {} |
michael@0 | 96 | SkDrawLooper(SkReadBuffer& buffer) : INHERITED(buffer) {} |
michael@0 | 97 | |
michael@0 | 98 | private: |
michael@0 | 99 | typedef SkFlattenable INHERITED; |
michael@0 | 100 | }; |
michael@0 | 101 | |
michael@0 | 102 | #endif |