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 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 LulRWLock_h
8 #define LulRWLock_h
10 #include "LulPlatformMacros.h"
11 #include <pthread.h>
13 // This class provides a simple wrapper around reader-writer locks.
14 // This is necessary because Android 2.2's libpthread does not
15 // provide such functionality, so there has to be a way to provide
16 // an alternative with an equivalent interface.
18 namespace lul {
20 class LulRWLock {
22 public:
23 LulRWLock();
24 ~LulRWLock();
25 void WrLock();
26 void RdLock();
27 void Unlock();
29 private:
30 #if defined(LUL_OS_android)
31 pthread_mutex_t mLock;
32 #elif defined(LUL_OS_linux)
33 pthread_rwlock_t mLock;
34 #else
35 # error "Unsupported OS"
36 #endif
38 };
40 } // namespace lul
42 #endif // LulRWLock_h