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 | * Copyright 2013 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef SkImageGenerator_DEFINED |
michael@0 | 9 | #define SkImageGenerator_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "SkDiscardableMemory.h" |
michael@0 | 12 | #include "SkImageInfo.h" |
michael@0 | 13 | |
michael@0 | 14 | class SkBitmap; |
michael@0 | 15 | class SkData; |
michael@0 | 16 | class SkImageGenerator; |
michael@0 | 17 | |
michael@0 | 18 | /** |
michael@0 | 19 | * Takes ownership of SkImageGenerator. If this method fails for |
michael@0 | 20 | * whatever reason, it will return false and immediatetely delete |
michael@0 | 21 | * the generator. If it succeeds, it will modify destination |
michael@0 | 22 | * bitmap. |
michael@0 | 23 | * |
michael@0 | 24 | * If generator is NULL, will safely return false. |
michael@0 | 25 | * |
michael@0 | 26 | * If this fails or when the SkDiscardablePixelRef that is |
michael@0 | 27 | * installed into destination is destroyed, it will call |
michael@0 | 28 | * SkDELETE() on the generator. Therefore, generator should be |
michael@0 | 29 | * allocated with SkNEW() or SkNEW_ARGS(). |
michael@0 | 30 | * |
michael@0 | 31 | * @param destination Upon success, this bitmap will be |
michael@0 | 32 | * configured and have a pixelref installed. |
michael@0 | 33 | * |
michael@0 | 34 | * @param factory If not NULL, this object will be used as a |
michael@0 | 35 | * source of discardable memory when decoding. If NULL, then |
michael@0 | 36 | * SkDiscardableMemory::Create() will be called. |
michael@0 | 37 | * |
michael@0 | 38 | * @return true iff successful. |
michael@0 | 39 | */ |
michael@0 | 40 | SK_API bool SkInstallDiscardablePixelRef(SkImageGenerator* generator, |
michael@0 | 41 | SkBitmap* destination, |
michael@0 | 42 | SkDiscardableMemory::Factory* factory = NULL); |
michael@0 | 43 | |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * An interface that allows a purgeable PixelRef (such as a |
michael@0 | 47 | * SkDiscardablePixelRef) to decode and re-decode an image as needed. |
michael@0 | 48 | */ |
michael@0 | 49 | class SK_API SkImageGenerator { |
michael@0 | 50 | public: |
michael@0 | 51 | /** |
michael@0 | 52 | * The PixelRef which takes ownership of this SkImageGenerator |
michael@0 | 53 | * will call the image generator's destructor. |
michael@0 | 54 | */ |
michael@0 | 55 | virtual ~SkImageGenerator() { } |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * Return a ref to the encoded (i.e. compressed) representation, |
michael@0 | 59 | * of this data. |
michael@0 | 60 | * |
michael@0 | 61 | * If non-NULL is returned, the caller is responsible for calling |
michael@0 | 62 | * unref() on the data when it is finished. |
michael@0 | 63 | */ |
michael@0 | 64 | virtual SkData* refEncodedData() { return NULL; } |
michael@0 | 65 | |
michael@0 | 66 | /** |
michael@0 | 67 | * Return some information about the image, allowing the owner of |
michael@0 | 68 | * this object to allocate pixels. |
michael@0 | 69 | * |
michael@0 | 70 | * Repeated calls to this function should give the same results, |
michael@0 | 71 | * allowing the PixelRef to be immutable. |
michael@0 | 72 | * |
michael@0 | 73 | * @return false if anything goes wrong. |
michael@0 | 74 | */ |
michael@0 | 75 | virtual bool getInfo(SkImageInfo* info) = 0; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * Decode into the given pixels, a block of memory of size at |
michael@0 | 79 | * least (info.fHeight - 1) * rowBytes + (info.fWidth * |
michael@0 | 80 | * bytesPerPixel) |
michael@0 | 81 | * |
michael@0 | 82 | * Repeated calls to this function should give the same results, |
michael@0 | 83 | * allowing the PixelRef to be immutable. |
michael@0 | 84 | * |
michael@0 | 85 | * @param info A description of the format (config, size) |
michael@0 | 86 | * expected by the caller. This can simply be identical |
michael@0 | 87 | * to the info returned by getInfo(). |
michael@0 | 88 | * |
michael@0 | 89 | * This contract also allows the caller to specify |
michael@0 | 90 | * different output-configs, which the implementation can |
michael@0 | 91 | * decide to support or not. |
michael@0 | 92 | * |
michael@0 | 93 | * @return false if anything goes wrong or if the image info is |
michael@0 | 94 | * unsupported. |
michael@0 | 95 | */ |
michael@0 | 96 | virtual bool getPixels(const SkImageInfo& info, |
michael@0 | 97 | void* pixels, |
michael@0 | 98 | size_t rowBytes) = 0; |
michael@0 | 99 | }; |
michael@0 | 100 | |
michael@0 | 101 | #endif // SkImageGenerator_DEFINED |