зеркало из https://github.com/mozilla/gecko-dev.git
Bug 831193 (part 4) - Don't use NS_MEMORY_REPORTER_IMPLEMENT in SharedMemory.cpp. r=cjones.
--HG-- extra : rebase_source : 0781ae1c947ba8312bdc7b71d969c3a56b7a7ae4
This commit is contained in:
Родитель
eb0a0a84bd
Коммит
1b9e228bfb
|
@ -25,7 +25,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
@ -36,6 +35,7 @@
|
|||
class mozIApplication;
|
||||
class nsConsoleService;
|
||||
class nsIDOMBlob;
|
||||
class nsIMemoryReporter;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
@ -17,23 +16,29 @@ namespace ipc {
|
|||
|
||||
static Atomic<size_t> gShmemAllocated;
|
||||
static Atomic<size_t> gShmemMapped;
|
||||
static size_t GetShmemAllocated() { return gShmemAllocated; }
|
||||
static size_t GetShmemMapped() { return gShmemMapped; }
|
||||
|
||||
NS_THREADSAFE_MEMORY_REPORTER_IMPLEMENT(ShmemAllocated,
|
||||
"shmem-allocated",
|
||||
KIND_OTHER,
|
||||
UNITS_BYTES,
|
||||
GetShmemAllocated,
|
||||
"Memory shared with other processes that is accessible (but not "
|
||||
"necessarily mapped).")
|
||||
class ShmemAllocatedReporter MOZ_FINAL : public MemoryReporterBase
|
||||
{
|
||||
public:
|
||||
ShmemAllocatedReporter()
|
||||
: MemoryReporterBase("shmem-allocated", KIND_OTHER, UNITS_BYTES,
|
||||
"Memory shared with other processes that is accessible (but not necessarily "
|
||||
"mapped).")
|
||||
{}
|
||||
private:
|
||||
int64_t Amount() MOZ_OVERRIDE { return gShmemAllocated; }
|
||||
};
|
||||
|
||||
NS_THREADSAFE_MEMORY_REPORTER_IMPLEMENT(ShmemMapped,
|
||||
"shmem-mapped",
|
||||
KIND_OTHER,
|
||||
UNITS_BYTES,
|
||||
GetShmemMapped,
|
||||
"Memory shared with other processes that is mapped into the address space.")
|
||||
class ShmemMappedReporter MOZ_FINAL : public MemoryReporterBase
|
||||
{
|
||||
public:
|
||||
ShmemMappedReporter()
|
||||
: MemoryReporterBase("shmem-mapped", KIND_OTHER, UNITS_BYTES,
|
||||
"Memory shared with other processes that is mapped into the address space.")
|
||||
{}
|
||||
private:
|
||||
int64_t Amount() MOZ_OVERRIDE { return gShmemMapped; }
|
||||
};
|
||||
|
||||
SharedMemory::SharedMemory()
|
||||
: mAllocSize(0)
|
||||
|
@ -41,8 +46,8 @@ SharedMemory::SharedMemory()
|
|||
{
|
||||
static Atomic<uint32_t> registered;
|
||||
if (registered.compareExchange(0, 1)) {
|
||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(ShmemAllocated));
|
||||
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(ShmemMapped));
|
||||
NS_RegisterMemoryReporter(new ShmemAllocatedReporter());
|
||||
NS_RegisterMemoryReporter(new ShmemMappedReporter());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче