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 SkError_DEFINED |
michael@0 | 9 | #define SkError_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | /** \file SkError.h |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | enum SkError { |
michael@0 | 16 | /** All is well |
michael@0 | 17 | */ |
michael@0 | 18 | kNoError_SkError=0, |
michael@0 | 19 | |
michael@0 | 20 | /** User argument passed to Skia function was invalid: NULL when that’s |
michael@0 | 21 | * not allowed, out of numeric range, bad enum, or violating some |
michael@0 | 22 | * other general precondition. |
michael@0 | 23 | */ |
michael@0 | 24 | kInvalidArgument_SkError, |
michael@0 | 25 | |
michael@0 | 26 | /** User tried to perform some operation in a state when the operation |
michael@0 | 27 | * was not legal, or the operands make no sense (e.g., asking for |
michael@0 | 28 | * pixels from an SkPictureCanvas). Other examples might be |
michael@0 | 29 | * inset()’ing a rectangle to make it degenerate (negative width/height). |
michael@0 | 30 | */ |
michael@0 | 31 | kInvalidOperation_SkError, |
michael@0 | 32 | |
michael@0 | 33 | /** Probably not needed right now, but in the future we could have opaque |
michael@0 | 34 | * handles for SkPictures floating around, and it would be a good idea |
michael@0 | 35 | * to anticipate this kind of issue. |
michael@0 | 36 | */ |
michael@0 | 37 | kInvalidHandle_SkError, |
michael@0 | 38 | |
michael@0 | 39 | /** This is probably not possible because paint surely has defaults for |
michael@0 | 40 | * everything, but perhaps a paint can get into a bad state somehow. |
michael@0 | 41 | */ |
michael@0 | 42 | kInvalidPaint_SkError, |
michael@0 | 43 | |
michael@0 | 44 | /** Skia was unable to allocate memory to perform some task. |
michael@0 | 45 | */ |
michael@0 | 46 | kOutOfMemory_SkError, |
michael@0 | 47 | |
michael@0 | 48 | /** Skia failed while trying to consume some external resource. |
michael@0 | 49 | */ |
michael@0 | 50 | kParseError_SkError, |
michael@0 | 51 | |
michael@0 | 52 | /** Something went wrong internally; could be resource exhaustion but |
michael@0 | 53 | * will often be a bug. |
michael@0 | 54 | */ |
michael@0 | 55 | kInternalError_SkError |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | /** Return the current per-thread error code. Error codes are "sticky"; they |
michael@0 | 59 | * are not not reset by subsequent successful operations. |
michael@0 | 60 | */ |
michael@0 | 61 | SkError SkGetLastError(); |
michael@0 | 62 | |
michael@0 | 63 | /** Clear the current per-thread error code back to kNoError_SkError. |
michael@0 | 64 | */ |
michael@0 | 65 | void SkClearLastError(); |
michael@0 | 66 | |
michael@0 | 67 | /** Type for callback functions to be invoked whenever an error is registered. |
michael@0 | 68 | * Callback functions take the error code being set, as well as a context |
michael@0 | 69 | * argument that is provided when the callback is registered. |
michael@0 | 70 | */ |
michael@0 | 71 | typedef void (*SkErrorCallbackFunction)(SkError, void *); |
michael@0 | 72 | |
michael@0 | 73 | /** Set the current per-thread error callback. |
michael@0 | 74 | * |
michael@0 | 75 | * @param cb The callback function to be invoked. Passing NULL |
michael@0 | 76 | * for cb will revert to the default error callback which |
michael@0 | 77 | * does nothing on release builds, but on debug builds will |
michael@0 | 78 | * print an informative error message to the screen. |
michael@0 | 79 | * @param context An arbitrary pointer that will be passed to |
michael@0 | 80 | * the provided callback function. |
michael@0 | 81 | */ |
michael@0 | 82 | void SkSetErrorCallback(SkErrorCallbackFunction cb, void *context); |
michael@0 | 83 | |
michael@0 | 84 | /** Get a human-readable description of the last (per-thread) error that |
michael@0 | 85 | * occurred. The returned error message will include not only a human |
michael@0 | 86 | * readable version of the error code, but also information about the |
michael@0 | 87 | * conditions that led to the error itself. |
michael@0 | 88 | */ |
michael@0 | 89 | const char *SkGetLastErrorString(); |
michael@0 | 90 | |
michael@0 | 91 | #endif /* SkError_DEFINED */ |