Skip to content

Commit 26ceee4

Browse files
committed
Back out 4537337759b7 (bug 910517) because nobody expects the talos inquisition
--HG-- rename : content/canvas/src/WebGLMemoryReporterWrapper.h => content/canvas/src/WebGLMemoryMultiReporterWrapper.h
1 parent e6e55b7 commit 26ceee4

File tree

67 files changed

+1292
-852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1292
-852
lines changed

addon-sdk/source/lib/sdk/test/harness.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ function reportMemoryUsage() {
148148
var mgr = Cc["@mozilla.org/memory-reporter-manager;1"]
149149
.getService(Ci.nsIMemoryReporterManager);
150150

151-
// XXX: this code is *so* bogus -- nsIMemoryReporter changed its |memoryUsed|
152-
// field to |amount| *years* ago, and even bigger changes have happened
153-
// since -- that it must just never be run.
154151
var reporters = mgr.enumerateReporters();
155152
if (reporters.hasMoreElements())
156153
print("\n");
@@ -379,7 +376,14 @@ function getPotentialLeaks() {
379376

380377
let enm = mgr.enumerateReporters();
381378
while (enm.hasMoreElements()) {
382-
let mr = enm.getNext().QueryInterface(Ci.nsIMemoryReporter);
379+
let reporter = enm.getNext().QueryInterface(Ci.nsIMemoryReporter);
380+
logReporter(reporter.process, reporter.path, reporter.kind, reporter.units,
381+
reporter.amount, reporter.description);
382+
}
383+
384+
let enm = mgr.enumerateMultiReporters();
385+
while (enm.hasMoreElements()) {
386+
let mr = enm.getNext().QueryInterface(Ci.nsIMemoryMultiReporter);
383387
mr.collectReports(logReporter, null);
384388
}
385389

content/base/src/nsContentUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,11 @@ static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
255255

256256
static PLDHashTable sEventListenerManagersHash;
257257

258-
class DOMEventListenerManagersHashReporter MOZ_FINAL : public MemoryUniReporter
258+
class DOMEventListenerManagersHashReporter MOZ_FINAL : public MemoryReporterBase
259259
{
260260
public:
261261
DOMEventListenerManagersHashReporter()
262-
: MemoryUniReporter(
262+
: MemoryReporterBase(
263263
"explicit/dom/event-listener-managers-hash",
264264
KIND_HEAP,
265265
UNITS_BYTES,

content/base/src/nsDOMFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ nsDOMMemoryFile::DataOwner::sMemoryReporterRegistered;
641641
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerMallocSizeOf)
642642

643643
class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
644-
: public nsIMemoryReporter
644+
: public nsIMemoryMultiReporter
645645
{
646646
NS_DECL_THREADSAFE_ISUPPORTS
647647

@@ -651,7 +651,7 @@ class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
651651
return NS_OK;
652652
}
653653

654-
NS_IMETHOD CollectReports(nsIMemoryReporterCallback *aCallback,
654+
NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *aCallback,
655655
nsISupports *aClosure)
656656
{
657657
typedef nsDOMMemoryFile::DataOwner DataOwner;
@@ -725,7 +725,7 @@ class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
725725
};
726726

727727
NS_IMPL_ISUPPORTS1(nsDOMMemoryFileDataOwnerMemoryReporter,
728-
nsIMemoryReporter)
728+
nsIMemoryMultiReporter)
729729

730730
/* static */ void
731731
nsDOMMemoryFile::DataOwner::EnsureMemoryReporterRegistered()
@@ -737,7 +737,7 @@ nsDOMMemoryFile::DataOwner::EnsureMemoryReporterRegistered()
737737

738738
nsRefPtr<nsDOMMemoryFileDataOwnerMemoryReporter> reporter = new
739739
nsDOMMemoryFileDataOwnerMemoryReporter();
740-
NS_RegisterMemoryReporter(reporter);
740+
NS_RegisterMemoryMultiReporter(reporter);
741741

742742
sMemoryReporterRegistered = true;
743743
}

content/canvas/src/CanvasRenderingContext2D.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ static int64_t gCanvasAzureMemoryUsed = 0;
143143
// This is KIND_OTHER because it's not always clear where in memory the pixels
144144
// of a canvas are stored. Furthermore, this memory will be tracked by the
145145
// underlying surface implementations. See bug 655638 for details.
146-
class Canvas2dPixelsReporter MOZ_FINAL : public MemoryUniReporter
146+
class Canvas2dPixelsReporter MOZ_FINAL : public MemoryReporterBase
147147
{
148148
public:
149149
Canvas2dPixelsReporter()
150-
: MemoryUniReporter("canvas-2d-pixels", KIND_OTHER, UNITS_BYTES,
150+
: MemoryReporterBase("canvas-2d-pixels", KIND_OTHER, UNITS_BYTES,
151151
"Memory used by 2D canvases. Each canvas requires (width * height * 4) bytes.")
152152
{}
153153
private:

content/canvas/src/WebGLContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "WebGLContextUtils.h"
1111
#include "WebGLBuffer.h"
1212
#include "WebGLVertexAttribData.h"
13-
#include "WebGLMemoryReporterWrapper.h"
13+
#include "WebGLMemoryMultiReporterWrapper.h"
1414
#include "WebGLFramebuffer.h"
1515
#include "WebGLVertexArray.h"
1616
#include "WebGLQuery.h"
@@ -179,7 +179,7 @@ WebGLContext::WebGLContext()
179179
mPixelStorePackAlignment = 4;
180180
mPixelStoreUnpackAlignment = 4;
181181

182-
WebGLMemoryReporterWrapper::AddWebGLContext(this);
182+
WebGLMemoryMultiReporterWrapper::AddWebGLContext(this);
183183

184184
mAllowRestore = true;
185185
mContextLossTimerRunning = false;
@@ -213,7 +213,7 @@ WebGLContext::WebGLContext()
213213
WebGLContext::~WebGLContext()
214214
{
215215
DestroyResourcesAndContext();
216-
WebGLMemoryReporterWrapper::RemoveWebGLContext(this);
216+
WebGLMemoryMultiReporterWrapper::RemoveWebGLContext(this);
217217
TerminateContextLossTimer();
218218
mContextRestorer = nullptr;
219219
}
@@ -653,8 +653,8 @@ void WebGLContext::LoseOldestWebGLContextIfLimitExceeded()
653653
// when choosing which one to lose first.
654654
UpdateLastUseIndex();
655655

656-
WebGLMemoryReporterWrapper::ContextsArrayType &contexts
657-
= WebGLMemoryReporterWrapper::Contexts();
656+
WebGLMemoryMultiReporterWrapper::ContextsArrayType &contexts
657+
= WebGLMemoryMultiReporterWrapper::Contexts();
658658

659659
// quick exit path, should cover a majority of cases
660660
if (contexts.Length() <= kMaxWebGLContextsPerPrincipal) {

content/canvas/src/WebGLContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class WebGLContext :
118118
{
119119
friend class WebGLContextUserData;
120120
friend class WebGLMemoryPressureObserver;
121-
friend class WebGLMemoryReporterWrapper;
121+
friend class WebGLMemoryMultiReporterWrapper;
122122
friend class WebGLExtensionLoseContext;
123123
friend class WebGLExtensionCompressedTextureS3TC;
124124
friend class WebGLExtensionCompressedTextureATC;

content/canvas/src/WebGLContextReporter.cpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

66
#include "WebGLContext.h"
7-
#include "WebGLMemoryReporterWrapper.h"
7+
#include "WebGLMemoryMultiReporterWrapper.h"
88
#include "nsIMemoryReporter.h"
99

1010
using namespace mozilla;
1111

1212
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
1313

14-
class WebGLMemoryReporter MOZ_FINAL : public nsIMemoryReporter
14+
class WebGLMemoryMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter
1515
{
1616
public:
1717
NS_DECL_ISUPPORTS
18-
NS_DECL_NSIMEMORYREPORTER
18+
NS_DECL_NSIMEMORYMULTIREPORTER
1919
};
2020

21-
NS_IMPL_ISUPPORTS1(WebGLMemoryReporter, nsIMemoryReporter)
21+
NS_IMPL_ISUPPORTS1(WebGLMemoryMultiReporter, nsIMemoryMultiReporter)
2222

2323
NS_IMETHODIMP
24-
WebGLMemoryReporter::GetName(nsACString &aName)
24+
WebGLMemoryMultiReporter::GetName(nsACString &aName)
2525
{
2626
aName.AssignLiteral("webgl");
2727
return NS_OK;
2828
}
2929

3030
NS_IMETHODIMP
31-
WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
32-
nsISupports* aClosure)
31+
WebGLMemoryMultiReporter::CollectReports(nsIMemoryMultiReporterCallback* aCb,
32+
nsISupports* aClosure)
3333
{
3434
#define REPORT(_path, _kind, _units, _amount, _desc) \
3535
do { \
@@ -42,21 +42,21 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
4242

4343
REPORT("webgl-texture-memory",
4444
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
45-
WebGLMemoryReporterWrapper::GetTextureMemoryUsed(),
45+
WebGLMemoryMultiReporterWrapper::GetTextureMemoryUsed(),
4646
"Memory used by WebGL textures.The OpenGL"
4747
" implementation is free to store these textures in either video"
4848
" memory or main memory. This measurement is only a lower bound,"
49-
" actual memory usage may be higher for example if the storage"
49+
" actual memory usage may be higher for example if the storage"
5050
" is strided.");
51-
51+
5252
REPORT("webgl-texture-count",
5353
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
54-
WebGLMemoryReporterWrapper::GetTextureCount(),
54+
WebGLMemoryMultiReporterWrapper::GetTextureCount(),
5555
"Number of WebGL textures.");
5656

5757
REPORT("webgl-buffer-memory",
5858
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
59-
WebGLMemoryReporterWrapper::GetBufferMemoryUsed(),
59+
WebGLMemoryMultiReporterWrapper::GetBufferMemoryUsed(),
6060
"Memory used by WebGL buffers. The OpenGL"
6161
" implementation is free to store these buffers in either video"
6262
" memory or main memory. This measurement is only a lower bound,"
@@ -65,7 +65,7 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
6565

6666
REPORT("explicit/webgl/buffer-cache-memory",
6767
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
68-
WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed(),
68+
WebGLMemoryMultiReporterWrapper::GetBufferCacheMemoryUsed(),
6969
"Memory used by WebGL buffer caches. The WebGL"
7070
" implementation caches the contents of element array buffers"
7171
" only.This adds up with the webgl-buffer-memory value, but"
@@ -74,69 +74,69 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
7474

7575
REPORT("webgl-buffer-count",
7676
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
77-
WebGLMemoryReporterWrapper::GetBufferCount(),
78-
"Number of WebGL buffers.");
79-
77+
WebGLMemoryMultiReporterWrapper::GetBufferCount(),
78+
"Number of WebGL buffers.");
79+
8080
REPORT("webgl-renderbuffer-memory",
8181
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
82-
WebGLMemoryReporterWrapper::GetRenderbufferMemoryUsed(),
82+
WebGLMemoryMultiReporterWrapper::GetRenderbufferMemoryUsed(),
8383
"Memory used by WebGL renderbuffers. The OpenGL"
8484
" implementation is free to store these renderbuffers in either"
8585
" video memory or main memory. This measurement is only a lower"
8686
" bound, actual memory usage may be higher for example if the"
8787
" storage is strided.");
88-
88+
8989
REPORT("webgl-renderbuffer-count",
9090
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
91-
WebGLMemoryReporterWrapper::GetRenderbufferCount(),
91+
WebGLMemoryMultiReporterWrapper::GetRenderbufferCount(),
9292
"Number of WebGL renderbuffers.");
93-
93+
9494
REPORT("explicit/webgl/shader",
9595
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
96-
WebGLMemoryReporterWrapper::GetShaderSize(),
96+
WebGLMemoryMultiReporterWrapper::GetShaderSize(),
9797
"Combined size of WebGL shader ASCII sources and translation"
98-
" logs cached on the heap.");
98+
" logs cached on the heap.");
9999

100100
REPORT("webgl-shader-count",
101101
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
102-
WebGLMemoryReporterWrapper::GetShaderCount(),
103-
"Number of WebGL shaders.");
102+
WebGLMemoryMultiReporterWrapper::GetShaderCount(),
103+
"Number of WebGL shaders.");
104104

105105
REPORT("webgl-context-count",
106106
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
107-
WebGLMemoryReporterWrapper::GetContextCount(),
108-
"Number of WebGL contexts.");
107+
WebGLMemoryMultiReporterWrapper::GetContextCount(),
108+
"Number of WebGL contexts.");
109109

110110
#undef REPORT
111111

112112
return NS_OK;
113113
}
114114

115-
WebGLMemoryReporterWrapper* WebGLMemoryReporterWrapper::sUniqueInstance = nullptr;
115+
WebGLMemoryMultiReporterWrapper* WebGLMemoryMultiReporterWrapper::sUniqueInstance = nullptr;
116116

117-
WebGLMemoryReporterWrapper* WebGLMemoryReporterWrapper::UniqueInstance()
117+
WebGLMemoryMultiReporterWrapper* WebGLMemoryMultiReporterWrapper::UniqueInstance()
118118
{
119119
if (!sUniqueInstance) {
120-
sUniqueInstance = new WebGLMemoryReporterWrapper;
120+
sUniqueInstance = new WebGLMemoryMultiReporterWrapper;
121121
}
122-
return sUniqueInstance;
122+
return sUniqueInstance;
123123
}
124124

125-
WebGLMemoryReporterWrapper::WebGLMemoryReporterWrapper()
126-
{
127-
mReporter = new WebGLMemoryReporter;
128-
NS_RegisterMemoryReporter(mReporter);
125+
WebGLMemoryMultiReporterWrapper::WebGLMemoryMultiReporterWrapper()
126+
{
127+
mReporter = new WebGLMemoryMultiReporter;
128+
NS_RegisterMemoryMultiReporter(mReporter);
129129
}
130130

131-
WebGLMemoryReporterWrapper::~WebGLMemoryReporterWrapper()
131+
WebGLMemoryMultiReporterWrapper::~WebGLMemoryMultiReporterWrapper()
132132
{
133-
NS_UnregisterMemoryReporter(mReporter);
133+
NS_UnregisterMemoryMultiReporter(mReporter);
134134
}
135135

136136
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)
137137

138-
int64_t
139-
WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed() {
138+
int64_t
139+
WebGLMemoryMultiReporterWrapper::GetBufferCacheMemoryUsed() {
140140
const ContextsArrayType & contexts = Contexts();
141141
int64_t result = 0;
142142
for(size_t i = 0; i < contexts.Length(); ++i) {
@@ -153,8 +153,8 @@ WebGLMemoryReporterWrapper::GetBufferCacheMemoryUsed() {
153153

154154
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOf)
155155

156-
int64_t
157-
WebGLMemoryReporterWrapper::GetShaderSize() {
156+
int64_t
157+
WebGLMemoryMultiReporterWrapper::GetShaderSize() {
158158
const ContextsArrayType & contexts = Contexts();
159159
int64_t result = 0;
160160
for(size_t i = 0; i < contexts.Length(); ++i) {

content/canvas/src/WebGLMemoryReporterWrapper.h renamed to content/canvas/src/WebGLMemoryMultiReporterWrapper.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* License, v. 2.0. If a copy of the MPL was not distributed with this
44
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
55

6-
#ifndef WEBGLMEMORYREPORTWRAPER_H_
7-
#define WEBGLMEMORYREPORTWRAPER_H_
6+
#ifndef WEBGLMEMORYMULTIREPORTWRAPER_H_
7+
#define WEBGLMEMORYMULTIREPORTWRAPER_H_
88

99
#include "WebGLContext.h"
1010
#include "WebGLBuffer.h"
@@ -17,21 +17,21 @@
1717

1818
namespace mozilla {
1919

20-
class WebGLMemoryReporterWrapper
20+
class WebGLMemoryMultiReporterWrapper
2121
{
22-
WebGLMemoryReporterWrapper();
23-
~WebGLMemoryReporterWrapper();
24-
static WebGLMemoryReporterWrapper* sUniqueInstance;
22+
WebGLMemoryMultiReporterWrapper();
23+
~WebGLMemoryMultiReporterWrapper();
24+
static WebGLMemoryMultiReporterWrapper* sUniqueInstance;
2525

26-
// here we store plain pointers, not RefPtrs: we don't want the
27-
// WebGLMemoryReporterWrapper unique instance to keep alive all
26+
// here we store plain pointers, not RefPtrs: we don't want the
27+
// WebGLMemoryMultiReporterWrapper unique instance to keep alive all
2828
// WebGLContexts ever created.
2929
typedef nsTArray<const WebGLContext*> ContextsArrayType;
3030
ContextsArrayType mContexts;
3131

32-
nsCOMPtr<nsIMemoryReporter> mReporter;
32+
nsCOMPtr<nsIMemoryMultiReporter> mReporter;
3333

34-
static WebGLMemoryReporterWrapper* UniqueInstance();
34+
static WebGLMemoryMultiReporterWrapper* UniqueInstance();
3535

3636
static ContextsArrayType & Contexts() { return UniqueInstance()->mContexts; }
3737

0 commit comments

Comments
 (0)