Make fewer copies when using StringBuilder.
Replace calls to .str() which copies with .Release which moves in cases where that's safe.
This CL was generated by this command:
git grep -l 'StringBuilder' |
xargs perl -i -0 -pe "s/(rtc::StringBuilder (\S+);.*?return )\\g2.str\(\)/\$1\$2.Release\(\)/sg"
Bug: webrtc:8982
Change-Id: If4dadbeb039df010aaaa9e58da81c1971a84fe8f
Reviewed-on: https://webrtc-review.googlesource.com/100307
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24790}
diff --git a/media/base/mediachannel.h b/media/base/mediachannel.h
index c1cc156..c7d8580 100644
--- a/media/base/mediachannel.h
+++ b/media/base/mediachannel.h
@@ -88,7 +88,7 @@
ost << vals[i].ToString();
}
ost << "]";
- return ost.str();
+ return ost.Release();
}
// Options that can be applied to a VideoMediaChannel or a VideoMediaEngine.
@@ -120,7 +120,7 @@
screencast_min_bitrate_kbps);
ost << ToStringIfSet("is_screencast ", is_screencast);
ost << "}";
- return ost.str();
+ return ost.Release();
}
// Enable denoising? This flag comes from the getUserMedia
@@ -157,7 +157,7 @@
ost << "uri: " << uri;
ost << ", id: " << id;
ost << "}";
- return ost.str();
+ return ost.Release();
}
std::string uri;
@@ -626,7 +626,7 @@
separator = ", ";
}
ost << "}";
- return ost.str();
+ return ost.Release();
}
protected: