tools/profiler/v8-support.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* This contains stubs and infrastructure to support code from v8 */
     8 #ifndef V8_SUPPORT_H_
     9 #define V8_SUPPORT_H_
    11 #if defined(_M_X64) || defined(__x86_64__)
    12 #define V8_HOST_ARCH_X64 1
    13 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
    14 #define V8_HOST_ARCH_IA32 1
    15 #elif defined(__ARMEL__)
    16 #define V8_HOST_ARCH_ARM 1
    17 #else
    18 #warning Please add support for your architecture in chromium_types.h
    19 #endif
    21 typedef int32_t Atomic32;
    23 #if defined(V8_HOST_ARCH_X64) || defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_ARM)
    24 inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
    25   *ptr = value;
    26 }
    27 #endif
    30 const int kMaxInt = 0x7FFFFFFF;
    31 const int kMinInt = -kMaxInt - 1;
    33 // A macro to disallow the evil copy constructor and operator= functions
    34 // This should be used in the private: declarations for a class
    35 #define DISALLOW_COPY_AND_ASSIGN(TypeName)      \
    36   TypeName(const TypeName&);                    \
    37   void operator=(const TypeName&)
    40 // The USE(x) template is used to silence C++ compiler warnings
    41 // issued for (yet) unused variables (typically parameters).
    42 template <typename T>
    43 static inline void USE(T) { }
    45 class Malloced {
    46 };
    48 #endif // V8_SUPPORT_H_

mercurial