tor-browser

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

RegisteredThread.cpp (1264B)


      1 /* -*- Mode: C++; tab-width: 2; 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/. */
      6 
      7 #include "RegisteredThread.h"
      8 
      9 #include "mozilla/BaseProfiler.h"
     10 
     11 namespace mozilla {
     12 namespace baseprofiler {
     13 
     14 RegisteredThread::RegisteredThread(ThreadInfo* aInfo, void* aStackTop)
     15    : mRacyRegisteredThread(aInfo->ThreadId()),
     16      mPlatformData(AllocPlatformData(aInfo->ThreadId())),
     17      mStackTop(aStackTop),
     18      mThreadInfo(aInfo) {
     19  // We don't have to guess on mac
     20 #if defined(GP_OS_darwin)
     21  pthread_t self = pthread_self();
     22  mStackTop = pthread_get_stackaddr_np(self);
     23 #endif
     24 }
     25 
     26 RegisteredThread::~RegisteredThread() {}
     27 
     28 size_t RegisteredThread::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
     29  size_t n = aMallocSizeOf(this);
     30 
     31  // Measurement of the following members may be added later if DMD finds it
     32  // is worthwhile:
     33  // - mPlatformData
     34  //
     35  // The following members are not measured:
     36  // - mThreadInfo: because it is non-owning
     37 
     38  return n;
     39 }
     40 
     41 }  // namespace baseprofiler
     42 }  // namespace mozilla