tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SandboxProfilerChild.h (1228B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
      4 
      5 #ifndef SANDBOX_PROFILER_CHILD_H
      6 #define SANDBOX_PROFILER_CHILD_H
      7 
      8 #include "SandboxProfiler.h"
      9 
     10 #if defined(HAVE_REPORT_UPROFILER_PARENT)
     11 #error Cannot include SandboxProfilerChild.h when already included SandboxProfilerParent.h
     12 #endif
     13 
     14 #define HAVE_REPORT_UPROFILER_CHILD
     15 
     16 namespace mozilla {
     17 
     18 /* static */
     19 bool SandboxProfiler::Init() {
     20  MOZ_ASSERT(!sInSignalContext,
     21             "SandboxProfiler::Init called in SIGSYS handler");
     22 
     23  if (!uprofiler_initted) {
     24    UPROFILER_GET(g);
     25    if (g && !g(&uprofiler)) {
     26      return false;
     27    }
     28  }
     29 
     30  MOZ_ASSERT(uprofiler.simple_event_marker_with_stack !=
     31                 simple_event_marker_with_stack_noop,
     32             "Marker sym OK");
     33  MOZ_ASSERT(uprofiler.native_backtrace != native_backtrace_noop,
     34             "Backtrace sym OK");
     35 
     36  if (uprofiler.native_backtrace &&
     37      uprofiler.native_backtrace != native_backtrace_noop) {
     38    uprofiler_initted = true;
     39    return true;
     40  }
     41 
     42  return false;
     43 }
     44 
     45 }  // namespace mozilla
     46 
     47 #endif  // SANDBOX_PROFILER_CHILD_H