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 2013 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 SkDebugUtils_DEFINED |
michael@0 | 11 | #define SkDebugUtils_DEFINED |
michael@0 | 12 | |
michael@0 | 13 | #include "SkTypes.h" |
michael@0 | 14 | |
michael@0 | 15 | // These functions dump 0, 1, and 2d arrays of data in a format that's |
michael@0 | 16 | // compatible with Mathematica for quick visualization |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | template<class T> |
michael@0 | 20 | inline void SkDebugDumpMathematica( const T val ) { |
michael@0 | 21 | SkDEBUGFAIL("Need to specialize SkDebugDumpMathematica for your type, sorry."); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | template<class T> |
michael@0 | 25 | inline void SkDebugDumpMathematica(const char *name, const T *array, int size) { |
michael@0 | 26 | SkDebugf(name); |
michael@0 | 27 | SkDebugf(" = {"); |
michael@0 | 28 | for (int i=0 ; i < size ; i++) { |
michael@0 | 29 | SkDebugDumpMathematica<T>(array[i]); |
michael@0 | 30 | if (i != size-1) SkDebugf(", "); |
michael@0 | 31 | } |
michael@0 | 32 | SkDebugf("};\n"); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | template<class T> |
michael@0 | 36 | inline void SkDebugDumpMathematica(const char *name, const T *array, int width, int height) { |
michael@0 | 37 | SkDebugf(name); |
michael@0 | 38 | SkDebugf(" = {\n"); |
michael@0 | 39 | for (int i=0 ; i < height ; i++) { |
michael@0 | 40 | SkDebugf(" {"); |
michael@0 | 41 | for (int j = 0 ; j < width ; j++) { |
michael@0 | 42 | SkDebugDumpMathematica<T>(array[i*width + j]); |
michael@0 | 43 | if (j != width-1) { |
michael@0 | 44 | SkDebugf(", "); |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | SkDebugf("}"); |
michael@0 | 48 | if (i != height-1) { |
michael@0 | 49 | SkDebugf(", \n"); |
michael@0 | 50 | } |
michael@0 | 51 | } |
michael@0 | 52 | SkDebugf("\n};\n"); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | template<class T> |
michael@0 | 56 | inline void SkDebugDumpMathematica( const char *name, const T val ) { |
michael@0 | 57 | SkDebugf(name); |
michael@0 | 58 | SkDebugf(" = "); |
michael@0 | 59 | SkDebugDumpMathematica<T>(val); |
michael@0 | 60 | SkDebugf(";\n"); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | template<> |
michael@0 | 64 | inline void SkDebugDumpMathematica<uint8_t>( const uint8_t val ) { |
michael@0 | 65 | SkDebugf("%u", val); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | template<> |
michael@0 | 69 | inline void SkDebugDumpMathematica<unsigned int>( const unsigned int val ) { |
michael@0 | 70 | SkDebugf("%u", val); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | template<> |
michael@0 | 74 | inline void SkDebugDumpMathematica<int>( const int val ) { |
michael@0 | 75 | SkDebugf("%d", val); |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | template<> |
michael@0 | 79 | inline void SkDebugDumpMathematica<size_t>( const size_t val ) { |
michael@0 | 80 | SkDebugf("%u", val); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | template<> |
michael@0 | 84 | void SkDebugDumpMathematica<const char *>( const char * val ) { |
michael@0 | 85 | SkDebugf("%s", val); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | template<> |
michael@0 | 89 | inline void SkDebugDumpMathematica<float>( float val ) { |
michael@0 | 90 | SkDebugf("%f", val); |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | |
michael@0 | 94 | #endif |