1 : /*
2 : * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/m-beta-lnx-codecoverage/build/xpcom/base/nsIMemoryReporter.idl
3 : */
4 :
5 : #ifndef __gen_nsIMemoryReporter_h__
6 : #define __gen_nsIMemoryReporter_h__
7 :
8 :
9 : #ifndef __gen_nsISupports_h__
10 : #include "nsISupports.h"
11 : #endif
12 :
13 : /* For IDL files that don't want to include root IDL files. */
14 : #ifndef NS_NO_VTABLE
15 : #define NS_NO_VTABLE
16 : #endif
17 : class nsISimpleEnumerator; /* forward declaration */
18 :
19 :
20 : /* starting interface: nsIMemoryReporter */
21 : #define NS_IMEMORYREPORTER_IID_STR "b2c39f65-1799-4b92-a806-ab3cf6af3cfa"
22 :
23 : #define NS_IMEMORYREPORTER_IID \
24 : {0xb2c39f65, 0x1799, 0x4b92, \
25 : { 0xa8, 0x06, 0xab, 0x3c, 0xf6, 0xaf, 0x3c, 0xfa }}
26 :
27 25146 : class NS_NO_VTABLE NS_SCRIPTABLE nsIMemoryReporter : public nsISupports {
28 : public:
29 :
30 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMEMORYREPORTER_IID)
31 :
32 : /* readonly attribute ACString process; */
33 : NS_SCRIPTABLE NS_IMETHOD GetProcess(nsACString & aProcess) = 0;
34 :
35 : /* readonly attribute AUTF8String path; */
36 : NS_SCRIPTABLE NS_IMETHOD GetPath(nsACString & aPath) = 0;
37 :
38 : enum {
39 : KIND_NONHEAP = 0,
40 : KIND_HEAP = 1,
41 : KIND_OTHER = 2,
42 : KIND_MAPPED = 0
43 : };
44 :
45 : /* readonly attribute PRInt32 kind; */
46 : NS_SCRIPTABLE NS_IMETHOD GetKind(PRInt32 *aKind) = 0;
47 :
48 : enum {
49 : UNITS_BYTES = 0,
50 : UNITS_COUNT = 1,
51 : UNITS_COUNT_CUMULATIVE = 2,
52 : UNITS_PERCENTAGE = 3
53 : };
54 :
55 : /* readonly attribute PRInt32 units; */
56 : NS_SCRIPTABLE NS_IMETHOD GetUnits(PRInt32 *aUnits) = 0;
57 :
58 : /* readonly attribute PRInt64 amount; */
59 : NS_SCRIPTABLE NS_IMETHOD GetAmount(PRInt64 *aAmount) = 0;
60 :
61 : /* readonly attribute AUTF8String description; */
62 : NS_SCRIPTABLE NS_IMETHOD GetDescription(nsACString & aDescription) = 0;
63 :
64 : };
65 :
66 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIMemoryReporter, NS_IMEMORYREPORTER_IID)
67 :
68 : /* Use this macro when declaring classes that implement this interface. */
69 : #define NS_DECL_NSIMEMORYREPORTER \
70 : NS_SCRIPTABLE NS_IMETHOD GetProcess(nsACString & aProcess); \
71 : NS_SCRIPTABLE NS_IMETHOD GetPath(nsACString & aPath); \
72 : NS_SCRIPTABLE NS_IMETHOD GetKind(PRInt32 *aKind); \
73 : NS_SCRIPTABLE NS_IMETHOD GetUnits(PRInt32 *aUnits); \
74 : NS_SCRIPTABLE NS_IMETHOD GetAmount(PRInt64 *aAmount); \
75 : NS_SCRIPTABLE NS_IMETHOD GetDescription(nsACString & aDescription);
76 :
77 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
78 : #define NS_FORWARD_NSIMEMORYREPORTER(_to) \
79 : NS_SCRIPTABLE NS_IMETHOD GetProcess(nsACString & aProcess) { return _to GetProcess(aProcess); } \
80 : NS_SCRIPTABLE NS_IMETHOD GetPath(nsACString & aPath) { return _to GetPath(aPath); } \
81 : NS_SCRIPTABLE NS_IMETHOD GetKind(PRInt32 *aKind) { return _to GetKind(aKind); } \
82 : NS_SCRIPTABLE NS_IMETHOD GetUnits(PRInt32 *aUnits) { return _to GetUnits(aUnits); } \
83 : NS_SCRIPTABLE NS_IMETHOD GetAmount(PRInt64 *aAmount) { return _to GetAmount(aAmount); } \
84 : NS_SCRIPTABLE NS_IMETHOD GetDescription(nsACString & aDescription) { return _to GetDescription(aDescription); }
85 :
86 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
87 : #define NS_FORWARD_SAFE_NSIMEMORYREPORTER(_to) \
88 : NS_SCRIPTABLE NS_IMETHOD GetProcess(nsACString & aProcess) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetProcess(aProcess); } \
89 : NS_SCRIPTABLE NS_IMETHOD GetPath(nsACString & aPath) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPath(aPath); } \
90 : NS_SCRIPTABLE NS_IMETHOD GetKind(PRInt32 *aKind) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetKind(aKind); } \
91 : NS_SCRIPTABLE NS_IMETHOD GetUnits(PRInt32 *aUnits) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUnits(aUnits); } \
92 : NS_SCRIPTABLE NS_IMETHOD GetAmount(PRInt64 *aAmount) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAmount(aAmount); } \
93 : NS_SCRIPTABLE NS_IMETHOD GetDescription(nsACString & aDescription) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDescription(aDescription); }
94 :
95 : #if 0
96 : /* Use the code below as a template for the implementation class for this interface. */
97 :
98 : /* Header file */
99 : class nsMemoryReporter : public nsIMemoryReporter
100 : {
101 : public:
102 : NS_DECL_ISUPPORTS
103 : NS_DECL_NSIMEMORYREPORTER
104 :
105 : nsMemoryReporter();
106 :
107 : private:
108 : ~nsMemoryReporter();
109 :
110 : protected:
111 : /* additional members */
112 : };
113 :
114 : /* Implementation file */
115 : NS_IMPL_ISUPPORTS1(nsMemoryReporter, nsIMemoryReporter)
116 :
117 : nsMemoryReporter::nsMemoryReporter()
118 : {
119 : /* member initializers and constructor code */
120 : }
121 :
122 : nsMemoryReporter::~nsMemoryReporter()
123 : {
124 : /* destructor code */
125 : }
126 :
127 : /* readonly attribute ACString process; */
128 : NS_IMETHODIMP nsMemoryReporter::GetProcess(nsACString & aProcess)
129 : {
130 : return NS_ERROR_NOT_IMPLEMENTED;
131 : }
132 :
133 : /* readonly attribute AUTF8String path; */
134 : NS_IMETHODIMP nsMemoryReporter::GetPath(nsACString & aPath)
135 : {
136 : return NS_ERROR_NOT_IMPLEMENTED;
137 : }
138 :
139 : /* readonly attribute PRInt32 kind; */
140 : NS_IMETHODIMP nsMemoryReporter::GetKind(PRInt32 *aKind)
141 : {
142 : return NS_ERROR_NOT_IMPLEMENTED;
143 : }
144 :
145 : /* readonly attribute PRInt32 units; */
146 : NS_IMETHODIMP nsMemoryReporter::GetUnits(PRInt32 *aUnits)
147 : {
148 : return NS_ERROR_NOT_IMPLEMENTED;
149 : }
150 :
151 : /* readonly attribute PRInt64 amount; */
152 : NS_IMETHODIMP nsMemoryReporter::GetAmount(PRInt64 *aAmount)
153 : {
154 : return NS_ERROR_NOT_IMPLEMENTED;
155 : }
156 :
157 : /* readonly attribute AUTF8String description; */
158 : NS_IMETHODIMP nsMemoryReporter::GetDescription(nsACString & aDescription)
159 : {
160 : return NS_ERROR_NOT_IMPLEMENTED;
161 : }
162 :
163 : /* End of implementation class template. */
164 : #endif
165 :
166 :
167 : /* starting interface: nsIMemoryMultiReporterCallback */
168 : #define NS_IMEMORYMULTIREPORTERCALLBACK_IID_STR "5b15f3fa-ba15-443c-8337-7770f5f0ce5d"
169 :
170 : #define NS_IMEMORYMULTIREPORTERCALLBACK_IID \
171 : {0x5b15f3fa, 0xba15, 0x443c, \
172 : { 0x83, 0x37, 0x77, 0x70, 0xf5, 0xf0, 0xce, 0x5d }}
173 :
174 3 : class NS_NO_VTABLE NS_SCRIPTABLE nsIMemoryMultiReporterCallback : public nsISupports {
175 : public:
176 :
177 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMEMORYMULTIREPORTERCALLBACK_IID)
178 :
179 : /* void callback (in ACString process, in AUTF8String path, in PRInt32 kind, in PRInt32 units, in PRInt64 amount, in AUTF8String description, in nsISupports closure); */
180 : NS_SCRIPTABLE NS_IMETHOD Callback(const nsACString & process, const nsACString & path, PRInt32 kind, PRInt32 units, PRInt64 amount, const nsACString & description, nsISupports *closure) = 0;
181 :
182 : };
183 :
184 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIMemoryMultiReporterCallback, NS_IMEMORYMULTIREPORTERCALLBACK_IID)
185 :
186 : /* Use this macro when declaring classes that implement this interface. */
187 : #define NS_DECL_NSIMEMORYMULTIREPORTERCALLBACK \
188 : NS_SCRIPTABLE NS_IMETHOD Callback(const nsACString & process, const nsACString & path, PRInt32 kind, PRInt32 units, PRInt64 amount, const nsACString & description, nsISupports *closure);
189 :
190 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
191 : #define NS_FORWARD_NSIMEMORYMULTIREPORTERCALLBACK(_to) \
192 : NS_SCRIPTABLE NS_IMETHOD Callback(const nsACString & process, const nsACString & path, PRInt32 kind, PRInt32 units, PRInt64 amount, const nsACString & description, nsISupports *closure) { return _to Callback(process, path, kind, units, amount, description, closure); }
193 :
194 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
195 : #define NS_FORWARD_SAFE_NSIMEMORYMULTIREPORTERCALLBACK(_to) \
196 : NS_SCRIPTABLE NS_IMETHOD Callback(const nsACString & process, const nsACString & path, PRInt32 kind, PRInt32 units, PRInt64 amount, const nsACString & description, nsISupports *closure) { return !_to ? NS_ERROR_NULL_POINTER : _to->Callback(process, path, kind, units, amount, description, closure); }
197 :
198 : #if 0
199 : /* Use the code below as a template for the implementation class for this interface. */
200 :
201 : /* Header file */
202 : class nsMemoryMultiReporterCallback : public nsIMemoryMultiReporterCallback
203 : {
204 : public:
205 : NS_DECL_ISUPPORTS
206 : NS_DECL_NSIMEMORYMULTIREPORTERCALLBACK
207 :
208 : nsMemoryMultiReporterCallback();
209 :
210 : private:
211 : ~nsMemoryMultiReporterCallback();
212 :
213 : protected:
214 : /* additional members */
215 : };
216 :
217 : /* Implementation file */
218 : NS_IMPL_ISUPPORTS1(nsMemoryMultiReporterCallback, nsIMemoryMultiReporterCallback)
219 :
220 : nsMemoryMultiReporterCallback::nsMemoryMultiReporterCallback()
221 : {
222 : /* member initializers and constructor code */
223 : }
224 :
225 : nsMemoryMultiReporterCallback::~nsMemoryMultiReporterCallback()
226 : {
227 : /* destructor code */
228 : }
229 :
230 : /* void callback (in ACString process, in AUTF8String path, in PRInt32 kind, in PRInt32 units, in PRInt64 amount, in AUTF8String description, in nsISupports closure); */
231 : NS_IMETHODIMP nsMemoryMultiReporterCallback::Callback(const nsACString & process, const nsACString & path, PRInt32 kind, PRInt32 units, PRInt64 amount, const nsACString & description, nsISupports *closure)
232 : {
233 : return NS_ERROR_NOT_IMPLEMENTED;
234 : }
235 :
236 : /* End of implementation class template. */
237 : #endif
238 :
239 :
240 : /* starting interface: nsIMemoryMultiReporter */
241 : #define NS_IMEMORYMULTIREPORTER_IID_STR "61d498d5-b460-4398-a8ea-7f75208534b4"
242 :
243 : #define NS_IMEMORYMULTIREPORTER_IID \
244 : {0x61d498d5, 0xb460, 0x4398, \
245 : { 0xa8, 0xea, 0x7f, 0x75, 0x20, 0x85, 0x34, 0xb4 }}
246 :
247 6527 : class NS_NO_VTABLE NS_SCRIPTABLE nsIMemoryMultiReporter : public nsISupports {
248 : public:
249 :
250 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMEMORYMULTIREPORTER_IID)
251 :
252 : /* readonly attribute ACString name; */
253 : NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) = 0;
254 :
255 : /* void collectReports (in nsIMemoryMultiReporterCallback callback, in nsISupports closure); */
256 : NS_SCRIPTABLE NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *callback, nsISupports *closure) = 0;
257 :
258 : /* readonly attribute PRInt64 explicitNonHeap; */
259 : NS_SCRIPTABLE NS_IMETHOD GetExplicitNonHeap(PRInt64 *aExplicitNonHeap) = 0;
260 :
261 : };
262 :
263 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIMemoryMultiReporter, NS_IMEMORYMULTIREPORTER_IID)
264 :
265 : /* Use this macro when declaring classes that implement this interface. */
266 : #define NS_DECL_NSIMEMORYMULTIREPORTER \
267 : NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName); \
268 : NS_SCRIPTABLE NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *callback, nsISupports *closure); \
269 : NS_SCRIPTABLE NS_IMETHOD GetExplicitNonHeap(PRInt64 *aExplicitNonHeap);
270 :
271 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
272 : #define NS_FORWARD_NSIMEMORYMULTIREPORTER(_to) \
273 : NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return _to GetName(aName); } \
274 : NS_SCRIPTABLE NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *callback, nsISupports *closure) { return _to CollectReports(callback, closure); } \
275 : NS_SCRIPTABLE NS_IMETHOD GetExplicitNonHeap(PRInt64 *aExplicitNonHeap) { return _to GetExplicitNonHeap(aExplicitNonHeap); }
276 :
277 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
278 : #define NS_FORWARD_SAFE_NSIMEMORYMULTIREPORTER(_to) \
279 : NS_SCRIPTABLE NS_IMETHOD GetName(nsACString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
280 : NS_SCRIPTABLE NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *callback, nsISupports *closure) { return !_to ? NS_ERROR_NULL_POINTER : _to->CollectReports(callback, closure); } \
281 : NS_SCRIPTABLE NS_IMETHOD GetExplicitNonHeap(PRInt64 *aExplicitNonHeap) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExplicitNonHeap(aExplicitNonHeap); }
282 :
283 : #if 0
284 : /* Use the code below as a template for the implementation class for this interface. */
285 :
286 : /* Header file */
287 : class nsMemoryMultiReporter : public nsIMemoryMultiReporter
288 : {
289 : public:
290 : NS_DECL_ISUPPORTS
291 : NS_DECL_NSIMEMORYMULTIREPORTER
292 :
293 : nsMemoryMultiReporter();
294 :
295 : private:
296 : ~nsMemoryMultiReporter();
297 :
298 : protected:
299 : /* additional members */
300 : };
301 :
302 : /* Implementation file */
303 : NS_IMPL_ISUPPORTS1(nsMemoryMultiReporter, nsIMemoryMultiReporter)
304 :
305 : nsMemoryMultiReporter::nsMemoryMultiReporter()
306 : {
307 : /* member initializers and constructor code */
308 : }
309 :
310 : nsMemoryMultiReporter::~nsMemoryMultiReporter()
311 : {
312 : /* destructor code */
313 : }
314 :
315 : /* readonly attribute ACString name; */
316 : NS_IMETHODIMP nsMemoryMultiReporter::GetName(nsACString & aName)
317 : {
318 : return NS_ERROR_NOT_IMPLEMENTED;
319 : }
320 :
321 : /* void collectReports (in nsIMemoryMultiReporterCallback callback, in nsISupports closure); */
322 : NS_IMETHODIMP nsMemoryMultiReporter::CollectReports(nsIMemoryMultiReporterCallback *callback, nsISupports *closure)
323 : {
324 : return NS_ERROR_NOT_IMPLEMENTED;
325 : }
326 :
327 : /* readonly attribute PRInt64 explicitNonHeap; */
328 : NS_IMETHODIMP nsMemoryMultiReporter::GetExplicitNonHeap(PRInt64 *aExplicitNonHeap)
329 : {
330 : return NS_ERROR_NOT_IMPLEMENTED;
331 : }
332 :
333 : /* End of implementation class template. */
334 : #endif
335 :
336 :
337 : /* starting interface: nsIMemoryReporterManager */
338 : #define NS_IMEMORYREPORTERMANAGER_IID_STR "4527b1d8-a81f-4af3-9623-80e4120392c7"
339 :
340 : #define NS_IMEMORYREPORTERMANAGER_IID \
341 : {0x4527b1d8, 0xa81f, 0x4af3, \
342 : { 0x96, 0x23, 0x80, 0xe4, 0x12, 0x03, 0x92, 0xc7 }}
343 :
344 1419 : class NS_NO_VTABLE NS_SCRIPTABLE nsIMemoryReporterManager : public nsISupports {
345 : public:
346 :
347 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMEMORYREPORTERMANAGER_IID)
348 :
349 : /* nsISimpleEnumerator enumerateReporters (); */
350 : NS_SCRIPTABLE NS_IMETHOD EnumerateReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) = 0;
351 :
352 : /* nsISimpleEnumerator enumerateMultiReporters (); */
353 : NS_SCRIPTABLE NS_IMETHOD EnumerateMultiReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) = 0;
354 :
355 : /* void registerReporter (in nsIMemoryReporter reporter); */
356 : NS_SCRIPTABLE NS_IMETHOD RegisterReporter(nsIMemoryReporter *reporter) = 0;
357 :
358 : /* void registerMultiReporter (in nsIMemoryMultiReporter reporter); */
359 : NS_SCRIPTABLE NS_IMETHOD RegisterMultiReporter(nsIMemoryMultiReporter *reporter) = 0;
360 :
361 : /* void unregisterReporter (in nsIMemoryReporter reporter); */
362 : NS_SCRIPTABLE NS_IMETHOD UnregisterReporter(nsIMemoryReporter *reporter) = 0;
363 :
364 : /* void unregisterMultiReporter (in nsIMemoryMultiReporter reporter); */
365 : NS_SCRIPTABLE NS_IMETHOD UnregisterMultiReporter(nsIMemoryMultiReporter *reporter) = 0;
366 :
367 : /* void init (); */
368 : NS_SCRIPTABLE NS_IMETHOD Init(void) = 0;
369 :
370 : /* readonly attribute PRInt64 resident; */
371 : NS_SCRIPTABLE NS_IMETHOD GetResident(PRInt64 *aResident) = 0;
372 :
373 : /* readonly attribute PRInt64 explicit; */
374 : NS_SCRIPTABLE NS_IMETHOD GetExplicit(PRInt64 *aExplicit) = 0;
375 :
376 : /* readonly attribute boolean hasMozMallocUsableSize; */
377 : NS_SCRIPTABLE NS_IMETHOD GetHasMozMallocUsableSize(bool *aHasMozMallocUsableSize) = 0;
378 :
379 : };
380 :
381 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIMemoryReporterManager, NS_IMEMORYREPORTERMANAGER_IID)
382 :
383 : /* Use this macro when declaring classes that implement this interface. */
384 : #define NS_DECL_NSIMEMORYREPORTERMANAGER \
385 : NS_SCRIPTABLE NS_IMETHOD EnumerateReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM); \
386 : NS_SCRIPTABLE NS_IMETHOD EnumerateMultiReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM); \
387 : NS_SCRIPTABLE NS_IMETHOD RegisterReporter(nsIMemoryReporter *reporter); \
388 : NS_SCRIPTABLE NS_IMETHOD RegisterMultiReporter(nsIMemoryMultiReporter *reporter); \
389 : NS_SCRIPTABLE NS_IMETHOD UnregisterReporter(nsIMemoryReporter *reporter); \
390 : NS_SCRIPTABLE NS_IMETHOD UnregisterMultiReporter(nsIMemoryMultiReporter *reporter); \
391 : NS_SCRIPTABLE NS_IMETHOD Init(void); \
392 : NS_SCRIPTABLE NS_IMETHOD GetResident(PRInt64 *aResident); \
393 : NS_SCRIPTABLE NS_IMETHOD GetExplicit(PRInt64 *aExplicit); \
394 : NS_SCRIPTABLE NS_IMETHOD GetHasMozMallocUsableSize(bool *aHasMozMallocUsableSize);
395 :
396 : /* Use this macro to declare functions that forward the behavior of this interface to another object. */
397 : #define NS_FORWARD_NSIMEMORYREPORTERMANAGER(_to) \
398 : NS_SCRIPTABLE NS_IMETHOD EnumerateReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) { return _to EnumerateReporters(_retval); } \
399 : NS_SCRIPTABLE NS_IMETHOD EnumerateMultiReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) { return _to EnumerateMultiReporters(_retval); } \
400 : NS_SCRIPTABLE NS_IMETHOD RegisterReporter(nsIMemoryReporter *reporter) { return _to RegisterReporter(reporter); } \
401 : NS_SCRIPTABLE NS_IMETHOD RegisterMultiReporter(nsIMemoryMultiReporter *reporter) { return _to RegisterMultiReporter(reporter); } \
402 : NS_SCRIPTABLE NS_IMETHOD UnregisterReporter(nsIMemoryReporter *reporter) { return _to UnregisterReporter(reporter); } \
403 : NS_SCRIPTABLE NS_IMETHOD UnregisterMultiReporter(nsIMemoryMultiReporter *reporter) { return _to UnregisterMultiReporter(reporter); } \
404 : NS_SCRIPTABLE NS_IMETHOD Init(void) { return _to Init(); } \
405 : NS_SCRIPTABLE NS_IMETHOD GetResident(PRInt64 *aResident) { return _to GetResident(aResident); } \
406 : NS_SCRIPTABLE NS_IMETHOD GetExplicit(PRInt64 *aExplicit) { return _to GetExplicit(aExplicit); } \
407 : NS_SCRIPTABLE NS_IMETHOD GetHasMozMallocUsableSize(bool *aHasMozMallocUsableSize) { return _to GetHasMozMallocUsableSize(aHasMozMallocUsableSize); }
408 :
409 : /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
410 : #define NS_FORWARD_SAFE_NSIMEMORYREPORTERMANAGER(_to) \
411 : NS_SCRIPTABLE NS_IMETHOD EnumerateReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateReporters(_retval); } \
412 : NS_SCRIPTABLE NS_IMETHOD EnumerateMultiReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateMultiReporters(_retval); } \
413 : NS_SCRIPTABLE NS_IMETHOD RegisterReporter(nsIMemoryReporter *reporter) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterReporter(reporter); } \
414 : NS_SCRIPTABLE NS_IMETHOD RegisterMultiReporter(nsIMemoryMultiReporter *reporter) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterMultiReporter(reporter); } \
415 : NS_SCRIPTABLE NS_IMETHOD UnregisterReporter(nsIMemoryReporter *reporter) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterReporter(reporter); } \
416 : NS_SCRIPTABLE NS_IMETHOD UnregisterMultiReporter(nsIMemoryMultiReporter *reporter) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterMultiReporter(reporter); } \
417 : NS_SCRIPTABLE NS_IMETHOD Init(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Init(); } \
418 : NS_SCRIPTABLE NS_IMETHOD GetResident(PRInt64 *aResident) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetResident(aResident); } \
419 : NS_SCRIPTABLE NS_IMETHOD GetExplicit(PRInt64 *aExplicit) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExplicit(aExplicit); } \
420 : NS_SCRIPTABLE NS_IMETHOD GetHasMozMallocUsableSize(bool *aHasMozMallocUsableSize) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetHasMozMallocUsableSize(aHasMozMallocUsableSize); }
421 :
422 : #if 0
423 : /* Use the code below as a template for the implementation class for this interface. */
424 :
425 : /* Header file */
426 : class nsMemoryReporterManager : public nsIMemoryReporterManager
427 : {
428 : public:
429 : NS_DECL_ISUPPORTS
430 : NS_DECL_NSIMEMORYREPORTERMANAGER
431 :
432 : nsMemoryReporterManager();
433 :
434 : private:
435 : ~nsMemoryReporterManager();
436 :
437 : protected:
438 : /* additional members */
439 : };
440 :
441 : /* Implementation file */
442 : NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)
443 :
444 : nsMemoryReporterManager::nsMemoryReporterManager()
445 : {
446 : /* member initializers and constructor code */
447 : }
448 :
449 : nsMemoryReporterManager::~nsMemoryReporterManager()
450 : {
451 : /* destructor code */
452 : }
453 :
454 : /* nsISimpleEnumerator enumerateReporters (); */
455 : NS_IMETHODIMP nsMemoryReporterManager::EnumerateReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM)
456 : {
457 : return NS_ERROR_NOT_IMPLEMENTED;
458 : }
459 :
460 : /* nsISimpleEnumerator enumerateMultiReporters (); */
461 : NS_IMETHODIMP nsMemoryReporterManager::EnumerateMultiReporters(nsISimpleEnumerator * *_retval NS_OUTPARAM)
462 : {
463 : return NS_ERROR_NOT_IMPLEMENTED;
464 : }
465 :
466 : /* void registerReporter (in nsIMemoryReporter reporter); */
467 : NS_IMETHODIMP nsMemoryReporterManager::RegisterReporter(nsIMemoryReporter *reporter)
468 : {
469 : return NS_ERROR_NOT_IMPLEMENTED;
470 : }
471 :
472 : /* void registerMultiReporter (in nsIMemoryMultiReporter reporter); */
473 : NS_IMETHODIMP nsMemoryReporterManager::RegisterMultiReporter(nsIMemoryMultiReporter *reporter)
474 : {
475 : return NS_ERROR_NOT_IMPLEMENTED;
476 : }
477 :
478 : /* void unregisterReporter (in nsIMemoryReporter reporter); */
479 : NS_IMETHODIMP nsMemoryReporterManager::UnregisterReporter(nsIMemoryReporter *reporter)
480 : {
481 : return NS_ERROR_NOT_IMPLEMENTED;
482 : }
483 :
484 : /* void unregisterMultiReporter (in nsIMemoryMultiReporter reporter); */
485 : NS_IMETHODIMP nsMemoryReporterManager::UnregisterMultiReporter(nsIMemoryMultiReporter *reporter)
486 : {
487 : return NS_ERROR_NOT_IMPLEMENTED;
488 : }
489 :
490 : /* void init (); */
491 : NS_IMETHODIMP nsMemoryReporterManager::Init()
492 : {
493 : return NS_ERROR_NOT_IMPLEMENTED;
494 : }
495 :
496 : /* readonly attribute PRInt64 resident; */
497 : NS_IMETHODIMP nsMemoryReporterManager::GetResident(PRInt64 *aResident)
498 : {
499 : return NS_ERROR_NOT_IMPLEMENTED;
500 : }
501 :
502 : /* readonly attribute PRInt64 explicit; */
503 : NS_IMETHODIMP nsMemoryReporterManager::GetExplicit(PRInt64 *aExplicit)
504 : {
505 : return NS_ERROR_NOT_IMPLEMENTED;
506 : }
507 :
508 : /* readonly attribute boolean hasMozMallocUsableSize; */
509 : NS_IMETHODIMP nsMemoryReporterManager::GetHasMozMallocUsableSize(bool *aHasMozMallocUsableSize)
510 : {
511 : return NS_ERROR_NOT_IMPLEMENTED;
512 : }
513 :
514 : /* End of implementation class template. */
515 : #endif
516 :
517 :
518 : /*
519 : * Note that this defaults 'process' to "", which is usually what's desired.
520 : */
521 : #define NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_classname, _path, _kind, _units, _amountFunction, _desc, _ts) \
522 : class MemoryReporter_##_classname MOZ_FINAL : public nsIMemoryReporter { \
523 : public: \
524 : NS_DECL_ISUPPORTS \
525 : NS_IMETHOD GetProcess(nsACString &process) { process.Truncate(); return NS_OK; } \
526 : NS_IMETHOD GetPath(nsACString &memoryPath) { memoryPath.Assign(_path); return NS_OK; } \
527 : NS_IMETHOD GetKind(int *kind) { *kind = _kind; return NS_OK; } \
528 : NS_IMETHOD GetUnits(int *units) { *units = _units; return NS_OK; } \
529 : NS_IMETHOD GetAmount(PRInt64 *amount) { *amount = _amountFunction(); return NS_OK; } \
530 : NS_IMETHOD GetDescription(nsACString &desc) { desc.Assign(_desc); return NS_OK; } \
531 : }; \
532 : NS_IMPL##_ts##ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter)
533 : #define NS_MEMORY_REPORTER_IMPLEMENT(_c, _p, _k, _u, _a, _d) \
534 : NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_c, _p, _k, _u, _a, _d, _)
535 : #define NS_THREADSAFE_MEMORY_REPORTER_IMPLEMENT(_c, _p, _k, _u, _a, _d) \
536 : NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_c, _p, _k, _u, _a, _d, _THREADSAFE_)
537 : #define NS_MEMORY_REPORTER_NAME(_classname) MemoryReporter_##_classname
538 : nsresult NS_RegisterMemoryReporter(nsIMemoryReporter *reporter);
539 : nsresult NS_RegisterMemoryMultiReporter(nsIMemoryMultiReporter *reporter);
540 : nsresult NS_UnregisterMemoryReporter(nsIMemoryReporter *reporter);
541 : nsresult NS_UnregisterMemoryMultiReporter(nsIMemoryMultiReporter *reporter);
542 : // Because DMD is not a tool that comes with the standard Valgrind
543 : // distribution, we have to #include our own local copy of dmd.h. Ugly but
544 : // unavoidable.
545 : #ifdef MOZ_DMD
546 : #if MOZ_MEMORY
547 : #error "--disable-jemalloc should have been forced when --enable-dmd was specified"
548 : #endif
549 : #include "dmd.h"
550 : #endif
551 : namespace mozilla {
552 : /*
553 : * Functions generated via this macro should be used by all traversal-based
554 : * memory reporters. Such functions return |moz_malloc_size_of(ptr)|; this
555 : * will always be zero on some obscure platforms.
556 : *
557 : * You might be wondering why we have a macro that creates multiple functions
558 : * distinguished only by |name|, instead of a single MemoryReporterMallocSizeOf
559 : * function. It's mostly to help with DMD integration, though it sometimes
560 : * also helps with debugging and temporary ad hoc profiling. The |name| chosen
561 : * doesn't matter greatly, but it's best to make it similar to the path used by
562 : * the relevant memory reporter(s).
563 : */
564 : #define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(fn, name) \
565 : static size_t fn(const void *ptr) \
566 : { \
567 : size_t usable = moz_malloc_size_of(ptr); \
568 : VALGRIND_DMD_REPORT(ptr, usable, name); \
569 : return usable; \
570 : }
571 : /*
572 : * Like NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN, but the created function sends an
573 : * "unreport" message to DMD.
574 : */
575 : #define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN_UN(fn) \
576 : static size_t fn(const void *ptr) \
577 : { \
578 : size_t usable = moz_malloc_size_of(ptr); \
579 : VALGRIND_DMD_UNREPORT(ptr); \
580 : return usable; \
581 : }
582 : #ifdef MOZ_DMD
583 : /*
584 : * This runs all the memory reporters but does nothing with the results; i.e.
585 : * it does the minimal amount of work possible for DMD to do its thing. Then
586 : * it dumps the DMD output to stderr (or somewhere else, if one of
587 : * DMD/Valgrind's logging options was used).
588 : */
589 : void DMDCheckAndDump();
590 : #else
591 : #define VALGRIND_DMD_REPORT(ptr, usable, name)
592 : #define VALGRIND_DMD_UNREPORT(ptr)
593 : #endif /* defined(MOZ_DMD) */
594 : }
595 :
596 : #endif /* __gen_nsIMemoryReporter_h__ */
|