Sat, 03 Jan 2015 20:18:00 +0100
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 (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
7 //
8 // This file contains the posix specific functions
9 //
10 #include "compiler/osinclude.h"
12 #if !defined(ANGLE_OS_POSIX)
13 #error Trying to build a posix specific file in a non-posix build.
14 #endif
16 //
17 // Thread Local Storage Operations
18 //
19 OS_TLSIndex OS_AllocTLSIndex()
20 {
21 pthread_key_t pPoolIndex;
23 //
24 // Create global pool key.
25 //
26 if ((pthread_key_create(&pPoolIndex, NULL)) != 0) {
27 assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
28 return false;
29 }
30 else {
31 return pPoolIndex;
32 }
33 }
36 bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
37 {
38 if (nIndex == OS_INVALID_TLS_INDEX) {
39 assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
40 return false;
41 }
43 if (pthread_setspecific(nIndex, lpvValue) == 0)
44 return true;
45 else
46 return false;
47 }
50 bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
51 {
52 if (nIndex == OS_INVALID_TLS_INDEX) {
53 assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
54 return false;
55 }
57 //
58 // Delete the global pool key.
59 //
60 if (pthread_key_delete(nIndex) == 0)
61 return true;
62 else
63 return false;
64 }