Last Comment Bug 731923 - Convert the N "gfx-surface" memory reporters to a single multi-reporter
: Convert the N "gfx-surface" memory reporters to a single multi-reporter
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Nicholas Nethercote [:njn]
:
: Milan Sreckovic [:milan]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-29 22:56 PST by Nicholas Nethercote [:njn]
Modified: 2012-03-20 03:46 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (5.97 KB, patch)
2012-02-29 22:56 PST, Nicholas Nethercote [:njn]
justin.lebar+bug: review+
Details | Diff | Splinter Review

Description Nicholas Nethercote [:njn] 2012-02-29 22:56:10 PST
Created attachment 601882 [details] [diff] [review]
patch

This patch converts the many "gfx-surface" single reporters into one
multi-reporter.  This makes the reporting feel a lot more natural and
similar to other cases in the codebase.
Comment 1 Justin Lebar (not reading bugmail) 2012-03-02 08:47:11 PST
> class SurfaceMemoryReporter :
>+    public nsIMemoryMultiReporter
> {
> public:
>+    SurfaceMemoryReporter()
>     { }
> 
>     NS_DECL_ISUPPORTS
> 
>+    NS_IMETHOD GetName(nsACString &name)
>+    {
>+        name.Assign("gfx-surface");

Nit: AssignLiteral. (Assign works fine, but AssignLiteral avoids a strlen.  Doesn't matter here, but we should set a good example.)

>         return NS_OK;
>     }
> 
>+    NS_IMETHOD CollectReports(nsIMemoryMultiReporterCallback *aCb,
>+                              nsISupports *aClosure)
>+    {
>+        size_t len = NS_ARRAY_LENGTH(sSurfaceMemoryReporterAttrs);
>+        for (size_t i = 0; i < len; i++) {
>+            PRInt64 amount = gSurfaceMemoryUsed[i];
>+
>+            if (amount != 0) {
>+                const char *path = sSurfaceMemoryReporterAttrs[i].path;
>+
>+                const char *desc = sSurfaceMemoryReporterAttrs[i].description;

Nit: Remove newline above?

>+                if (!desc) {
>+                    desc = sDefaultSurfaceDescription;
>+                }
>+
>+                nsresult rv;
>+                rv = aCb->Callback(EmptyCString(), nsCString(path),
>+                                   nsIMemoryReporter::KIND_OTHER,
>+                                   nsIMemoryReporter::UNITS_BYTES, 
>+                                   gSurfaceMemoryUsed[i],
>+                                   nsCString(desc), aClosure);

Nit: |nsresult rv = aCb->|?  (The line fits in 80 chars...)
Comment 2 Nicholas Nethercote [:njn] 2012-03-19 20:09:38 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/73456bef6c31
Comment 3 Mounir Lamouri (:mounir) 2012-03-20 03:46:09 PDT
https://hg.mozilla.org/mozilla-central/rev/73456bef6c31

Note You need to log in before you can comment on or make changes to this bug.