michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "JSStreamWriter.h" michael@0: #include "ProfilerBacktrace.h" michael@0: #include "SyncProfile.h" michael@0: michael@0: michael@0: ProfilerBacktrace::ProfilerBacktrace(SyncProfile* aProfile) michael@0: : mProfile(aProfile) michael@0: { michael@0: MOZ_ASSERT(aProfile); michael@0: } michael@0: michael@0: ProfilerBacktrace::~ProfilerBacktrace() michael@0: { michael@0: if (mProfile->ShouldDestroy()) { michael@0: delete mProfile; michael@0: } michael@0: } michael@0: michael@0: void michael@0: ProfilerBacktrace::StreamJSObject(JSStreamWriter& b) michael@0: { michael@0: mozilla::MutexAutoLock lock(*mProfile->GetMutex()); michael@0: mProfile->StreamJSObject(b); michael@0: }