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 2008 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 SkPackBits_DEFINED |
michael@0 | 11 | #define SkPackBits_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkTypes.h" |
michael@0 | 14 | |
michael@0 | 15 | class SkPackBits { |
michael@0 | 16 | public: |
michael@0 | 17 | /** Given the number of 16bit values that will be passed to Pack16, |
michael@0 | 18 | returns the worst-case size needed for the dst[] buffer. |
michael@0 | 19 | */ |
michael@0 | 20 | static size_t ComputeMaxSize16(int count); |
michael@0 | 21 | |
michael@0 | 22 | /** Given the number of 8bit values that will be passed to Pack8, |
michael@0 | 23 | returns the worst-case size needed for the dst[] buffer. |
michael@0 | 24 | */ |
michael@0 | 25 | static size_t ComputeMaxSize8(int count); |
michael@0 | 26 | |
michael@0 | 27 | /** Write the src array into a packed format. The packing process may end |
michael@0 | 28 | up writing more bytes than it read, so dst[] must be large enough. |
michael@0 | 29 | @param src Input array of 16bit values |
michael@0 | 30 | @param count Number of entries in src[] |
michael@0 | 31 | @param dst Buffer (allocated by caller) to write the packed data |
michael@0 | 32 | into |
michael@0 | 33 | @return the number of bytes written to dst[] |
michael@0 | 34 | */ |
michael@0 | 35 | static size_t Pack16(const uint16_t src[], int count, uint8_t dst[]); |
michael@0 | 36 | |
michael@0 | 37 | /** Write the src array into a packed format. The packing process may end |
michael@0 | 38 | up writing more bytes than it read, so dst[] must be large enough. |
michael@0 | 39 | @param src Input array of 8bit values |
michael@0 | 40 | @param count Number of entries in src[] |
michael@0 | 41 | @param dst Buffer (allocated by caller) to write the packed data |
michael@0 | 42 | into |
michael@0 | 43 | @return the number of bytes written to dst[] |
michael@0 | 44 | */ |
michael@0 | 45 | static size_t Pack8(const uint8_t src[], int count, uint8_t dst[]); |
michael@0 | 46 | |
michael@0 | 47 | /** Unpack the data in src[], and expand it into dst[]. The src[] data was |
michael@0 | 48 | written by a previous call to Pack16. |
michael@0 | 49 | @param src Input data to unpack, previously created by Pack16. |
michael@0 | 50 | @param srcSize Number of bytes of src to unpack |
michael@0 | 51 | @param dst Buffer (allocated by caller) to expand the src[] into. |
michael@0 | 52 | @return the number of dst elements (not bytes) written into dst. |
michael@0 | 53 | */ |
michael@0 | 54 | static int Unpack16(const uint8_t src[], size_t srcSize, uint16_t dst[]); |
michael@0 | 55 | |
michael@0 | 56 | /** Unpack the data in src[], and expand it into dst[]. The src[] data was |
michael@0 | 57 | written by a previous call to Pack8. |
michael@0 | 58 | @param src Input data to unpack, previously created by Pack8. |
michael@0 | 59 | @param srcSize Number of bytes of src to unpack |
michael@0 | 60 | @param dst Buffer (allocated by caller) to expand the src[] into. |
michael@0 | 61 | @return the number of bytes written into dst. |
michael@0 | 62 | */ |
michael@0 | 63 | static int Unpack8(const uint8_t src[], size_t srcSize, uint8_t dst[]); |
michael@0 | 64 | |
michael@0 | 65 | /** Unpack the data from src[], skip the first dstSkip bytes, then write |
michael@0 | 66 | dstWrite bytes into dst[]. The src[] data was written by a previous |
michael@0 | 67 | call to Pack8. Return the number of bytes actually writtten into dst[] |
michael@0 | 68 | @param src Input data to unpack, previously created by Pack8. |
michael@0 | 69 | @param dst Buffer (allocated by caller) to expand the src[] into. |
michael@0 | 70 | @param dstSkip Number of bytes of unpacked src to skip before writing |
michael@0 | 71 | into dst |
michael@0 | 72 | @param dstWrite Number of bytes of unpacked src to write into dst (after |
michael@0 | 73 | skipping dstSkip bytes) |
michael@0 | 74 | */ |
michael@0 | 75 | static void Unpack8(uint8_t dst[], size_t dstSkip, size_t dstWrite, |
michael@0 | 76 | const uint8_t src[]); |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | #endif |