gfx/skia/trunk/include/core/SkError.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

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

mercurial