Bug 1166492 - Return UniquePtr<char[]> from profiler_get_profile to avoid double copying. (r=mstange)

This commit is contained in:
Shu-yu Guo
2015-05-26 22:58:40 -07:00
parent c382500b46
commit cdf2319b67
10 changed files with 26 additions and 23 deletions

View File

@@ -2566,10 +2566,9 @@ PluginModuleChild::RecvStopProfiler()
bool
PluginModuleChild::AnswerGetProfile(nsCString* aProfile)
{
char* profile = profiler_get_profile();
UniquePtr<char[]> profile = profiler_get_profile();
if (profile != nullptr) {
*aProfile = nsCString(profile, strlen(profile));
free(profile);
*aProfile = nsCString(profile.get(), strlen(profile.get()));
} else {
*aProfile = nsCString("", 0);
}