Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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 #include "compiler/osinclude.h"
8 //
9 // This file contains contains the window's specific functions
10 //
12 #if !defined(ANGLE_OS_WIN)
13 #error Trying to build a windows specific file in a non windows build.
14 #endif
17 //
18 // Thread Local Storage Operations
19 //
20 OS_TLSIndex OS_AllocTLSIndex()
21 {
22 DWORD dwIndex = TlsAlloc();
23 if (dwIndex == TLS_OUT_OF_INDEXES) {
24 assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
25 return OS_INVALID_TLS_INDEX;
26 }
28 return dwIndex;
29 }
32 bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
33 {
34 if (nIndex == OS_INVALID_TLS_INDEX) {
35 assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
36 return false;
37 }
39 if (TlsSetValue(nIndex, lpvValue))
40 return true;
41 else
42 return false;
43 }
46 bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
47 {
48 if (nIndex == OS_INVALID_TLS_INDEX) {
49 assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
50 return false;
51 }
53 if (TlsFree(nIndex))
54 return true;
55 else
56 return false;
57 }