xpcom/build/PoisonIOInterposer.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 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim:set ts=4 sw=4 sts=4 ci et: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_PoisonIOInterposer_h
     8 #define mozilla_PoisonIOInterposer_h
    10 #include "mozilla/Types.h"
    11 #include <stdio.h>
    13 MOZ_BEGIN_EXTERN_C
    15 /** Register file descriptor to be ignored by poisoning IO interposer */
    16 void MozillaRegisterDebugFD(int fd);
    18 /** Register file to be ignored by poisoning IO interposer */
    19 void MozillaRegisterDebugFILE(FILE *f);
    21 /** Unregister file descriptor from being ignored by poisoning IO interposer */
    22 void MozillaUnRegisterDebugFD(int fd);
    24 /** Unregister file from being ignored by poisoning IO interposer */
    25 void MozillaUnRegisterDebugFILE(FILE *f);
    27 MOZ_END_EXTERN_C
    29 #if defined(XP_WIN) || defined(XP_MACOSX)
    31 #ifdef __cplusplus
    32 namespace mozilla {
    34 /**
    35  * Check if a file is registered as a debug file.
    36  */
    37 bool IsDebugFile(intptr_t aFileID);
    39 /**
    40  * Initialize IO poisoning, this is only safe to do on the main-thread when no
    41  * other threads are running.
    42  *
    43  * Please, note that this probably has performance implications as all
    44  */
    45 void InitPoisonIOInterposer();
    47 #ifdef XP_MACOSX
    48 /**
    49  * Check that writes are dirty before reporting I/O (Mac OS X only)
    50  * This is necessary for late-write checks on Mac OS X, but reading the buffer
    51  * from file to see if we're writing dirty bits is expensive, so we don't want
    52  * to do this for everything else that uses
    53  */
    54 void OnlyReportDirtyWrites();
    55 #endif /* XP_MACOSX */
    57 /**
    58  * Clear IO poisoning, this is only safe to do on the main-thread when no other
    59  * threads are running.
    60  */
    61 void ClearPoisonIOInterposer();
    63 } // namespace mozilla
    64 #endif /* __cplusplus */
    66 #else /* XP_WIN || XP_MACOSX */
    68 #ifdef __cplusplus
    69 namespace mozilla {
    70 inline bool IsDebugFile(intptr_t aFileID){ return true; }
    71 inline void InitPoisonIOInterposer(){}
    72 inline void ClearPoisonIOInterposer(){}
    73 #ifdef XP_MACOSX
    74 inline void OnlyReportDirtyWrites(){}
    75 #endif /* XP_MACOSX */
    76 } // namespace mozilla
    77 #endif /* __cplusplus */
    79 #endif /* XP_WIN || XP_MACOSX */
    81 #endif // mozilla_PoisonIOInterposer_h

mercurial