gfx/skia/trunk/src/ports/SkMemory_mozalloc.cpp

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 2011 Google Inc.
     3  * Copyright 2012 Mozilla Foundation
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     9 #include "SkTypes.h"
    11 #include "mozilla/mozalloc.h"
    12 #include "mozilla/mozalloc_abort.h"
    13 #include "mozilla/mozalloc_oom.h"
    15 void sk_throw() {
    16     SkDEBUGFAIL("sk_throw");
    17     mozalloc_abort("Abort from sk_throw");
    18 }
    20 void sk_out_of_memory(void) {
    21     SkDEBUGFAIL("sk_out_of_memory");
    22     mozalloc_handle_oom(0);
    23 }
    25 void* sk_malloc_throw(size_t size) {
    26     return sk_malloc_flags(size, SK_MALLOC_THROW);
    27 }
    29 void* sk_realloc_throw(void* addr, size_t size) {
    30     return moz_xrealloc(addr, size);
    31 }
    33 void sk_free(void* p) {
    34     moz_free(p);
    35 }
    37 void* sk_malloc_flags(size_t size, unsigned flags) {
    38     return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size);
    39 }
    41 void* sk_calloc(size_t size) {
    42     return moz_calloc(size, 1);
    43 }
    45 void* sk_calloc_throw(size_t size) {
    46     return moz_xcalloc(size, 1);
    47 }

mercurial