Closed
Bug 814704
Opened 12 years ago
Closed 12 years ago
Move the creation of a js object from combinedStacks into a static function.
Categories
(Toolkit :: Telemetry, defect)
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: espindola, Assigned: espindola)
References
Details
Attachments
(1 file, 1 obsolete file)
8.01 KB,
patch
|
vladan
:
review+
|
Details | Diff | Splinter Review |
I need exactly the same function for adding late writes to the telemetry ping.
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → respindola
Status: NEW → ASSIGNED
Assignee | ||
Updated•12 years ago
|
Attachment #684705 -
Attachment is patch: true
Attachment #684705 -
Flags: review?(vdjeric)
Comment 1•12 years ago
|
||
Comment on attachment 684705 [details] [diff] [review]
patch
Looks good, just a few small changes
> class HangReports {
...
>- const Telemetry::ProcessedStack::Module& GetModule(unsigned aIndex) const;
>+ const CombinedStacks& getStacks() const;
GetStacks instead
>+static JSObject *
>+CreateJSStackObject(JSContext *cx, const CombinedStacks &stacks);
Put this near the top of the file
>+ JSObject *durationArray = JS_NewArrayObject(cx, 0, nullptr);
Check for nullptr
>+ for (size_t i = 0, n = stacks.GetStackCount(); i < n; ++i) {
>+ jsval duration = INT_TO_JSVAL(mHangReports.GetDuration(i));
>+ if (!JS_SetElement(cx, durationArray, i, &duration)) {
>+ return NS_ERROR_FAILURE;
>+ }
>+ }
Nitpick: declare "const size_t length = stacks.GetStackCount();" before the for-loop for readability. Same for others
>- const uint32_t moduleCount = mHangReports.GetModuleCount();
>+ const uint32_t moduleCount = stacks.GetModuleCount();
Nit: size_t
Attachment #684705 -
Flags: review?(vdjeric) → review-
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #684705 -
Attachment is obsolete: true
Attachment #685174 -
Flags: review?(vdjeric)
Updated•12 years ago
|
Attachment #685174 -
Flags: review?(vdjeric) → review+
Assignee | ||
Comment 3•12 years ago
|
||
Comment 4•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in
before you can comment on or make changes to this bug.
Description
•