js/src/builtin/Profilers.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     2  * vim: set ts=8 sts=4 et sw=4 tw=99:
     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 /*
     8  * Functions for controlling profilers from within JS: Valgrind, Perf,
     9  * Shark, etc.
    10  */
    11 #ifndef builtin_Profilers_h
    12 #define builtin_Profilers_h
    14 #include "jstypes.h"
    16 #ifdef _MSC_VER
    17 typedef int pid_t;
    18 #else
    19 #include <unistd.h>
    20 #endif
    22 /**
    23  * Start any profilers that are available and have been configured on for this
    24  * platform. This is NOT thread safe.
    25  *
    26  * The profileName is used by some profilers to describe the current profiling
    27  * run. It may be used for part of the filename of the output, but the
    28  * specifics depend on the profiler. Many profilers will ignore it. Passing in
    29  * nullptr is legal; some profilers may use it to output to stdout or similar.
    30  *
    31  * Returns true if no profilers fail to start.
    32  */
    33 extern JS_PUBLIC_API(bool)
    34 JS_StartProfiling(const char *profileName, pid_t pid);
    36 /**
    37  * Stop any profilers that were previously started with JS_StartProfiling.
    38  * Returns true if no profilers fail to stop.
    39  */
    40 extern JS_PUBLIC_API(bool)
    41 JS_StopProfiling(const char *profileName);
    43 /**
    44  * Write the current profile data to the given file, if applicable to whatever
    45  * profiler is being used.
    46  */
    47 extern JS_PUBLIC_API(bool)
    48 JS_DumpProfile(const char *outfile, const char *profileName);
    50 /**
    51  * Pause currently active profilers (only supported by some profilers). Returns
    52  * whether any profilers failed to pause. (Profilers that do not support
    53  * pause/resume do not count.)
    54  */
    55 extern JS_PUBLIC_API(bool)
    56 JS_PauseProfilers(const char *profileName);
    58 /**
    59  * Resume suspended profilers
    60  */
    61 extern JS_PUBLIC_API(bool)
    62 JS_ResumeProfilers(const char *profileName);
    64 /**
    65  * The profiling API calls are not able to report errors, so they use a
    66  * thread-unsafe global memory buffer to hold the last error encountered. This
    67  * should only be called after something returns false.
    68  */
    69 JS_PUBLIC_API(const char *)
    70 JS_UnsafeGetLastProfilingError();
    72 #ifdef MOZ_CALLGRIND
    74 extern JS_FRIEND_API(bool)
    75 js_StopCallgrind();
    77 extern JS_FRIEND_API(bool)
    78 js_StartCallgrind();
    80 extern JS_FRIEND_API(bool)
    81 js_DumpCallgrind(const char *outfile);
    83 #endif /* MOZ_CALLGRIND */
    85 #ifdef __linux__
    87 extern JS_FRIEND_API(bool)
    88 js_StartPerf();
    90 extern JS_FRIEND_API(bool)
    91 js_StopPerf();
    93 #endif /* __linux__ */
    95 #endif /* builtin_Profilers_h */

mercurial