Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | /* declarations needed by both nsTraceMalloc.c and nsWinTraceMalloc.cpp */ |
michael@0 | 8 | |
michael@0 | 9 | #ifndef NSTRACEMALLOCCALLBACKS_H |
michael@0 | 10 | #define NSTRACEMALLOCCALLBACKS_H |
michael@0 | 11 | |
michael@0 | 12 | #include <stdint.h> |
michael@0 | 13 | #include <stdlib.h> |
michael@0 | 14 | |
michael@0 | 15 | #ifdef __cplusplus |
michael@0 | 16 | extern "C" { |
michael@0 | 17 | #endif |
michael@0 | 18 | |
michael@0 | 19 | /* Used by backtrace. */ |
michael@0 | 20 | typedef struct stack_buffer_info { |
michael@0 | 21 | void **buffer; |
michael@0 | 22 | size_t size; |
michael@0 | 23 | size_t entries; |
michael@0 | 24 | } stack_buffer_info; |
michael@0 | 25 | |
michael@0 | 26 | typedef struct tm_thread tm_thread; |
michael@0 | 27 | struct tm_thread { |
michael@0 | 28 | /* |
michael@0 | 29 | * This counter suppresses tracing, in case any tracing code needs |
michael@0 | 30 | * to malloc. |
michael@0 | 31 | */ |
michael@0 | 32 | uint32_t suppress_tracing; |
michael@0 | 33 | |
michael@0 | 34 | /* buffer for backtrace, below */ |
michael@0 | 35 | stack_buffer_info backtrace_buf; |
michael@0 | 36 | }; |
michael@0 | 37 | |
michael@0 | 38 | /* implemented in nsTraceMalloc.c */ |
michael@0 | 39 | tm_thread * tm_get_thread(void); |
michael@0 | 40 | |
michael@0 | 41 | /* implemented in nsTraceMalloc.c */ |
michael@0 | 42 | PR_EXTERN(void) MallocCallback(void *aPtr, size_t aSize, uint32_t start, uint32_t end, tm_thread *t); |
michael@0 | 43 | PR_EXTERN(void) CallocCallback(void *aPtr, size_t aCount, size_t aSize, uint32_t start, uint32_t end, tm_thread *t); |
michael@0 | 44 | PR_EXTERN(void) ReallocCallback(void *aPin, void* aPout, size_t aSize, uint32_t start, uint32_t end, tm_thread *t); |
michael@0 | 45 | PR_EXTERN(void) FreeCallback(void *aPtr, uint32_t start, uint32_t end, tm_thread *t); |
michael@0 | 46 | |
michael@0 | 47 | #ifdef XP_WIN32 |
michael@0 | 48 | /* implemented in nsTraceMalloc.c */ |
michael@0 | 49 | PR_EXTERN(void) StartupHooker(); |
michael@0 | 50 | PR_EXTERN(void) ShutdownHooker(); |
michael@0 | 51 | |
michael@0 | 52 | /* implemented in nsWinTraceMalloc.cpp */ |
michael@0 | 53 | void* dhw_orig_malloc(size_t); |
michael@0 | 54 | void* dhw_orig_calloc(size_t, size_t); |
michael@0 | 55 | void* dhw_orig_realloc(void*, size_t); |
michael@0 | 56 | void dhw_orig_free(void*); |
michael@0 | 57 | |
michael@0 | 58 | #endif /* defined(XP_WIN32) */ |
michael@0 | 59 | |
michael@0 | 60 | #ifdef __cplusplus |
michael@0 | 61 | } |
michael@0 | 62 | #endif |
michael@0 | 63 | |
michael@0 | 64 | #endif /* !defined(NSTRACEMALLOCCALLBACKS_H) */ |