js/src/vm/PosixNSPR.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: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * vim: set ts=8 sts=4 et sw=4 tw=99:
     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 vm_PosixNSPR_h
     8 #define vm_PosixNSPR_h
    10 #ifdef JS_POSIX_NSPR
    12 #ifndef JS_THREADSAFE
    13 #error "This file must not be included in non-threadsafe mode"
    14 #endif
    16 #include <pthread.h>
    17 #include <stdint.h>
    19 namespace nspr {
    20 class Thread;
    21 class Lock;
    22 class CondVar;
    23 };
    25 typedef nspr::Thread PRThread;
    26 typedef nspr::Lock PRLock;
    27 typedef nspr::CondVar PRCondVar;
    29 enum PRThreadType {
    30    PR_USER_THREAD,
    31    PR_SYSTEM_THREAD
    32 };
    34 enum PRThreadPriority
    35 {
    36    PR_PRIORITY_FIRST   = 0,
    37    PR_PRIORITY_LOW     = 0,
    38    PR_PRIORITY_NORMAL  = 1,
    39    PR_PRIORITY_HIGH    = 2,
    40    PR_PRIORITY_URGENT  = 3,
    41    PR_PRIORITY_LAST    = 3
    42 };
    44 enum PRThreadScope {
    45    PR_LOCAL_THREAD,
    46    PR_GLOBAL_THREAD,
    47    PR_GLOBAL_BOUND_THREAD
    48 };
    50 enum PRThreadState {
    51    PR_JOINABLE_THREAD,
    52    PR_UNJOINABLE_THREAD
    53 };
    55 PRThread *
    56 PR_CreateThread(PRThreadType type,
    57                 void (*start)(void *arg),
    58                 void *arg,
    59                 PRThreadPriority priority,
    60                 PRThreadScope scope,
    61                 PRThreadState state,
    62                 uint32_t stackSize);
    64 typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
    66 PRStatus
    67 PR_JoinThread(PRThread *thread);
    69 PRThread *
    70 PR_GetCurrentThread();
    72 PRStatus
    73 PR_SetCurrentThreadName(const char *name);
    75 typedef void (*PRThreadPrivateDTOR)(void *priv);
    77 PRStatus
    78 PR_NewThreadPrivateIndex(unsigned *newIndex, PRThreadPrivateDTOR destructor);
    80 PRStatus
    81 PR_SetThreadPrivate(unsigned index, void *priv);
    83 void *
    84 PR_GetThreadPrivate(unsigned index);
    86 struct PRCallOnceType {
    87     int initialized;
    88     int32_t inProgress;
    89     PRStatus status;
    90 };
    92 typedef PRStatus (*PRCallOnceFN)();
    94 PRStatus
    95 PR_CallOnce(PRCallOnceType *once, PRCallOnceFN func);
    97 typedef PRStatus (*PRCallOnceWithArgFN)(void *);
    99 PRStatus
   100 PR_CallOnceWithArg(PRCallOnceType *once, PRCallOnceWithArgFN func, void *arg);
   102 PRLock *
   103 PR_NewLock();
   105 void
   106 PR_DestroyLock(PRLock *lock);
   108 void
   109 PR_Lock(PRLock *lock);
   111 PRStatus
   112 PR_Unlock(PRLock *lock);
   114 PRCondVar *
   115 PR_NewCondVar(PRLock *lock);
   117 void
   118 PR_DestroyCondVar(PRCondVar *cvar);
   120 PRStatus
   121 PR_NotifyCondVar(PRCondVar *cvar);
   123 PRStatus
   124 PR_NotifyAllCondVar(PRCondVar *cvar);
   126 #define PR_INTERVAL_MIN 1000UL
   127 #define PR_INTERVAL_MAX 100000UL
   129 #define PR_INTERVAL_NO_WAIT 0UL
   130 #define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
   132 uint32_t
   133 PR_MillisecondsToInterval(uint32_t milli);
   135 uint32_t
   136 PR_TicksPerSecond();
   138 PRStatus
   139 PR_WaitCondVar(PRCondVar *cvar, uint32_t timeout);
   141 #endif /* JS_POSIX_NSPR */
   143 #endif /* vm_PosixNSPR_h */

mercurial