no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / js / src / util / AllocationLogging.cpp
blob92d74b3091a9494a70e292f4d1f098ffe5ca514a
1 /* -*- Mode: C++; tab-width: 8; 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/. */
7 #include "js/AllocationLogging.h"
9 #include "mozilla/Assertions.h" // MOZ_ASSERT
11 static JS::LogCtorDtor sLogCtor = nullptr;
12 static JS::LogCtorDtor sLogDtor = nullptr;
14 void JS::SetLogCtorDtorFunctions(LogCtorDtor ctor, LogCtorDtor dtor) {
15 MOZ_ASSERT(!sLogCtor && !sLogDtor);
16 MOZ_ASSERT(ctor && dtor);
17 sLogCtor = ctor;
18 sLogDtor = dtor;
21 void JS::LogCtor(void* self, const char* type, uint32_t sz) {
22 if (LogCtorDtor fun = sLogCtor) {
23 fun(self, type, sz);
27 void JS::LogDtor(void* self, const char* type, uint32_t sz) {
28 if (LogCtorDtor fun = sLogDtor) {
29 fun(self, type, sz);