security/sandbox/chromium/base/profiler/alternate_timer.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.

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 // This is a glue file, which allows third party code to call into our profiler
michael@0 6 // without having to include most any functions from base.
michael@0 7
michael@0 8 #ifndef BASE_PROFILER_ALTERNATE_TIMER_H_
michael@0 9 #define BASE_PROFILER_ALTERNATE_TIMER_H_
michael@0 10
michael@0 11 #include "base/base_export.h"
michael@0 12
michael@0 13 namespace tracked_objects {
michael@0 14
michael@0 15 enum TimeSourceType {
michael@0 16 TIME_SOURCE_TYPE_WALL_TIME,
michael@0 17 TIME_SOURCE_TYPE_TCMALLOC
michael@0 18 };
michael@0 19
michael@0 20 // Provide type for an alternate timer function.
michael@0 21 typedef unsigned int NowFunction();
michael@0 22
michael@0 23 // Environment variable name that is used to activate alternate timer profiling
michael@0 24 // (such as using TCMalloc allocations to provide a pseudo-timer) for tasks
michael@0 25 // instead of wall clock profiling.
michael@0 26 BASE_EXPORT extern const char kAlternateProfilerTime[];
michael@0 27
michael@0 28 // Set an alternate timer function to replace the OS time function when
michael@0 29 // profiling. Typically this is called by an allocator that is providing a
michael@0 30 // function that indicates how much memory has been allocated on any given
michael@0 31 // thread.
michael@0 32 BASE_EXPORT void SetAlternateTimeSource(NowFunction* now_function,
michael@0 33 TimeSourceType type);
michael@0 34
michael@0 35 // Gets the pointer to a function that was set via SetAlternateTimeSource().
michael@0 36 // Returns NULL if no set was done prior to calling GetAlternateTimeSource.
michael@0 37 NowFunction* GetAlternateTimeSource();
michael@0 38
michael@0 39 // Returns the type of the currently set time source.
michael@0 40 BASE_EXPORT TimeSourceType GetTimeSourceType();
michael@0 41
michael@0 42 } // namespace tracked_objects
michael@0 43
michael@0 44 #endif // BASE_PROFILER_ALTERNATE_TIMER_H_

mercurial