Convert the N "gfx-surface" memory reporters to a single multi-reporter

RESOLVED FIXED

Status

()

Core
Graphics
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: njn, Assigned: njn)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

5.97 KB, patch
Justin Lebar (not reading bugmail)
: review+
Details | Diff | Splinter Review
(Assignee)

Description

5 years ago
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.
Attachment #601882 - Flags: review?
(Assignee)

Updated

5 years ago
Attachment #601882 - Flags: review? → review?(justin.lebar+bug)
> 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...)
Attachment #601882 - Flags: review?(justin.lebar+bug) → review+
(Assignee)

Comment 2

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/73456bef6c31
https://hg.mozilla.org/mozilla-central/rev/73456bef6c31
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.