Closed Bug 1471347 Opened 6 years ago Closed 6 years ago

stop using std::string/stringstreams in profiler code

Categories

(Core :: Gecko Profiler, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(2 files)

Using operator<< and friends from the standard library requires locale-specific
formatting, which requires registry calls on Windows.  We can do better.
Using operator<< on stringstream on Windows dives into the registry for
locale-specific formatting details.  This behavior is neither desired
or (probably) anticipated by the code.  Instead, let's use our normal
Gecko string classes for SharedLibrary::mVersion.
Attachment #8987943 - Flags: review?(n.nethercote)
Similar to the previous part, we convert mBreakpadId to an nsCString to
avoid issues with locale-dependent std::string operations.

There are a lot of non-profiler changes here because a bunch of things
depend on the SharedLibrary object that the profiler defines.
Attachment #8987944 - Flags: review?(n.nethercote)
Attachment #8987943 - Flags: review?(n.nethercote) → review+
Comment on attachment 8987944 [details] [diff] [review]
part 2 - store an nsCString for SharedLibrary::mBreakpadId

Review of attachment 8987944 [details] [diff] [review]:
-----------------------------------------------------------------

::: tools/profiler/core/shared-libraries-linux.cc
@@ +70,5 @@
> +
> +  nsCString uuid;
> +  const std::string str = FileID::ConvertIdentifierToUUIDString(aIdentifier);
> +  uuid.Append(str.c_str(), str.size());
> +  uuid.Append('0');

'\0'?
Attachment #8987944 - Flags: review?(n.nethercote) → review+
'0' is correct: this is the "breakpad id age" which is set to the pdbAge on Windows and to zero on non-Windows.
Is this ready to land?
Flags: needinfo?(nfroyd)
Priority: -- → P1
Yes; I'm going to add a comment to avoid the confusion from comment 3.
Flags: needinfo?(nfroyd)
Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6b7ad73f1f43
part 1 - store an nsCString for SharedLibrary::mVersion; r=njn
https://hg.mozilla.org/integration/mozilla-inbound/rev/aadd0e8ef250
part 2 - store an nsCString for SharedLibrary::mBreakpadId; r=njn
https://hg.mozilla.org/mozilla-central/rev/6b7ad73f1f43
https://hg.mozilla.org/mozilla-central/rev/aadd0e8ef250
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: