Bug 936964 (part 6) - Rename WebGLMemoryReporterWrapper as WebGLMemoryTracker. r=bjacob.

--HG--
rename : content/canvas/src/WebGLMemoryReporterWrapper.h => content/canvas/src/WebGLMemoryTracker.h
extra : rebase_source : 7a215cf3dbcf0b78f8ab823828360dd0cfba26d3
This commit is contained in:
Nicholas Nethercote 2013-11-25 16:03:38 -08:00
parent e42e475b4f
commit 0b49067039
4 changed files with 33 additions and 33 deletions

View File

@ -10,7 +10,7 @@
#include "WebGLContextUtils.h"
#include "WebGLBuffer.h"
#include "WebGLVertexAttribData.h"
#include "WebGLMemoryReporterWrapper.h"
#include "WebGLMemoryTracker.h"
#include "WebGLFramebuffer.h"
#include "WebGLVertexArray.h"
#include "WebGLQuery.h"
@ -178,7 +178,7 @@ WebGLContext::WebGLContext()
mPixelStorePackAlignment = 4;
mPixelStoreUnpackAlignment = 4;
WebGLMemoryReporterWrapper::AddWebGLContext(this);
WebGLMemoryTracker::AddWebGLContext(this);
mAllowRestore = true;
mContextLossTimerRunning = false;
@ -212,7 +212,7 @@ WebGLContext::WebGLContext()
WebGLContext::~WebGLContext()
{
DestroyResourcesAndContext();
WebGLMemoryReporterWrapper::RemoveWebGLContext(this);
WebGLMemoryTracker::RemoveWebGLContext(this);
TerminateContextLossTimer();
mContextRestorer = nullptr;
}
@ -669,8 +669,8 @@ void WebGLContext::LoseOldestWebGLContextIfLimitExceeded()
// when choosing which one to lose first.
UpdateLastUseIndex();
WebGLMemoryReporterWrapper::ContextsArrayType &contexts
= WebGLMemoryReporterWrapper::Contexts();
WebGLMemoryTracker::ContextsArrayType &contexts
= WebGLMemoryTracker::Contexts();
// quick exit path, should cover a majority of cases
if (contexts.Length() <= kMaxWebGLContextsPerPrincipal) {

View File

@ -122,7 +122,7 @@ class WebGLContext :
{
friend class WebGLContextUserData;
friend class WebGLMemoryPressureObserver;
friend class WebGLMemoryReporterWrapper;
friend class WebGLMemoryTracker;
friend class WebGLExtensionLoseContext;
friend class WebGLExtensionCompressedTextureS3TC;
friend class WebGLExtensionCompressedTextureATC;

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGLContext.h"
#include "WebGLMemoryReporterWrapper.h"
#include "WebGLMemoryTracker.h"
#include "nsIMemoryReporter.h"
using namespace mozilla;
@ -37,7 +37,7 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
REPORT("webgl-texture-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryReporterWrapper::GetTextureMemoryUsed(),
WebGLMemoryTracker::GetTextureMemoryUsed(),
"Memory used by WebGL textures.The OpenGL"
" implementation is free to store these textures in either video"
" memory or main memory. This measurement is only a lower bound,"
@ -46,12 +46,12 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
REPORT("webgl-texture-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryReporterWrapper::GetTextureCount(),
WebGLMemoryTracker::GetTextureCount(),
"Number of WebGL textures.");
REPORT("webgl-buffer-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryReporterWrapper::GetBufferMemoryUsed(),
WebGLMemoryTracker::GetBufferMemoryUsed(),
"Memory used by WebGL buffers. The OpenGL"
" implementation is free to store these buffers in either video"
" memory or main memory. This measurement is only a lower bound,"
@ -60,7 +60,7 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
REPORT("explicit/webgl/buffer-cache-memory",
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed(),
WebGLMemoryTracker::GetBufferCacheMemoryUsed(),
"Memory used by WebGL buffer caches. The WebGL"
" implementation caches the contents of element array buffers"
" only.This adds up with the webgl-buffer-memory value, but"
@ -69,12 +69,12 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
REPORT("webgl-buffer-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryReporterWrapper::GetBufferCount(),
WebGLMemoryTracker::GetBufferCount(),
"Number of WebGL buffers.");
REPORT("webgl-renderbuffer-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryReporterWrapper::GetRenderbufferMemoryUsed(),
WebGLMemoryTracker::GetRenderbufferMemoryUsed(),
"Memory used by WebGL renderbuffers. The OpenGL"
" implementation is free to store these renderbuffers in either"
" video memory or main memory. This measurement is only a lower"
@ -83,23 +83,23 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
REPORT("webgl-renderbuffer-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryReporterWrapper::GetRenderbufferCount(),
WebGLMemoryTracker::GetRenderbufferCount(),
"Number of WebGL renderbuffers.");
REPORT("explicit/webgl/shader",
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryReporterWrapper::GetShaderSize(),
WebGLMemoryTracker::GetShaderSize(),
"Combined size of WebGL shader ASCII sources and translation"
" logs cached on the heap.");
REPORT("webgl-shader-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryReporterWrapper::GetShaderCount(),
WebGLMemoryTracker::GetShaderCount(),
"Number of WebGL shaders.");
REPORT("webgl-context-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryReporterWrapper::GetContextCount(),
WebGLMemoryTracker::GetContextCount(),
"Number of WebGL contexts.");
#undef REPORT
@ -107,25 +107,25 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
return NS_OK;
}
NS_IMPL_ISUPPORTS1(WebGLMemoryReporterWrapper, nsISupports)
NS_IMPL_ISUPPORTS1(WebGLMemoryTracker, nsISupports)
StaticRefPtr<WebGLMemoryReporterWrapper> WebGLMemoryReporterWrapper::sUniqueInstance;
StaticRefPtr<WebGLMemoryTracker> WebGLMemoryTracker::sUniqueInstance;
WebGLMemoryReporterWrapper* WebGLMemoryReporterWrapper::UniqueInstance()
WebGLMemoryTracker* WebGLMemoryTracker::UniqueInstance()
{
if (!sUniqueInstance) {
sUniqueInstance = new WebGLMemoryReporterWrapper;
sUniqueInstance = new WebGLMemoryTracker;
}
return sUniqueInstance;
}
WebGLMemoryReporterWrapper::WebGLMemoryReporterWrapper()
WebGLMemoryTracker::WebGLMemoryTracker()
{
mReporter = new WebGLMemoryReporter;
NS_RegisterMemoryReporter(mReporter);
}
WebGLMemoryReporterWrapper::~WebGLMemoryReporterWrapper()
WebGLMemoryTracker::~WebGLMemoryTracker()
{
NS_UnregisterMemoryReporter(mReporter);
}
@ -133,7 +133,7 @@ WebGLMemoryReporterWrapper::~WebGLMemoryReporterWrapper()
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)
int64_t
WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed() {
WebGLMemoryTracker::GetBufferCacheMemoryUsed() {
const ContextsArrayType & contexts = Contexts();
int64_t result = 0;
for(size_t i = 0; i < contexts.Length(); ++i) {
@ -151,7 +151,7 @@ WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed() {
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOf)
int64_t
WebGLMemoryReporterWrapper::GetShaderSize() {
WebGLMemoryTracker::GetShaderSize() {
const ContextsArrayType & contexts = Contexts();
int64_t result = 0;
for(size_t i = 0; i < contexts.Length(); ++i) {

View File

@ -3,8 +3,8 @@
* 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/. */
#ifndef WEBGLMEMORYREPORTERWRAPPER_H_
#define WEBGLMEMORYREPORTERWRAPPER_H_
#ifndef WEBGLMEMORYTRACKER_H_
#define WEBGLMEMORYTRACKER_H_
#include "WebGLContext.h"
#include "WebGLBuffer.h"
@ -18,23 +18,23 @@
namespace mozilla {
class WebGLMemoryReporterWrapper : public nsISupports
class WebGLMemoryTracker : public nsISupports
{
NS_DECL_ISUPPORTS
WebGLMemoryReporterWrapper();
virtual ~WebGLMemoryReporterWrapper();
static StaticRefPtr<WebGLMemoryReporterWrapper> sUniqueInstance;
WebGLMemoryTracker();
virtual ~WebGLMemoryTracker();
static StaticRefPtr<WebGLMemoryTracker> sUniqueInstance;
// here we store plain pointers, not RefPtrs: we don't want the
// WebGLMemoryReporterWrapper unique instance to keep alive all
// WebGLMemoryTracker unique instance to keep alive all
// WebGLContexts ever created.
typedef nsTArray<const WebGLContext*> ContextsArrayType;
ContextsArrayType mContexts;
nsCOMPtr<nsIMemoryReporter> mReporter;
static WebGLMemoryReporterWrapper* UniqueInstance();
static WebGLMemoryTracker* UniqueInstance();
static ContextsArrayType & Contexts() { return UniqueInstance()->mContexts; }