Unvirtualize more wasteful functions

Cleaning up instances of virtual functions with no overrides.
Savings of 1.4kb for chrome.dll file.

Note: These are the savings for Windows, relocation savings are
probably larger on other platforms.

GN args for builds:
use_goma=true
is_debug=false
target_cpu="x64"
use_lld=false
fatal_linker_warnings=false
symbol_level=2
dcheck_always_on = false

pe_summarize analysis pre-change -> change:
Size of out\Default\chrome.dll is 188.844544 MB
Size of out\SessionDescription\chrome.dll is 188.843520 MB
Memory size change from out\Default\chrome.dll
to out\SessionDescription\chrome.dll
       .text:    -704 bytes change
      .rdata:    -512 bytes change
      .pdata:     -48 bytes change
      .reloc:    -168 bytes change
Total change:   -1432 bytes

Bug: chromium:1371503
Change-Id: I51ad0a8acf3595fc499dbbcde2fab2d1bdf90fb9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283940
Commit-Queue: Ivan Rosales <rosalesi@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38713}
This commit is contained in:
Ivan Rosales 2022-11-17 12:15:31 -08:00 committed by WebRTC LUCI CQ
parent 8a8c455cce
commit 447b9f3fde

View File

@ -272,10 +272,10 @@ class MediaContentDescriptionImpl : public MediaContentDescription {
typedef C CodecType; typedef C CodecType;
// Codecs should be in preference order (most preferred codec first). // Codecs should be in preference order (most preferred codec first).
virtual const std::vector<C>& codecs() const { return codecs_; } const std::vector<C>& codecs() const { return codecs_; }
virtual void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; } void set_codecs(const std::vector<C>& codecs) { codecs_ = codecs; }
bool has_codecs() const override { return !codecs_.empty(); } bool has_codecs() const override { return !codecs_.empty(); }
virtual bool HasCodec(int id) { bool HasCodec(int id) {
bool found = false; bool found = false;
for (typename std::vector<C>::iterator iter = codecs_.begin(); for (typename std::vector<C>::iterator iter = codecs_.begin();
iter != codecs_.end(); ++iter) { iter != codecs_.end(); ++iter) {
@ -286,8 +286,8 @@ class MediaContentDescriptionImpl : public MediaContentDescription {
} }
return found; return found;
} }
virtual void AddCodec(const C& codec) { codecs_.push_back(codec); } void AddCodec(const C& codec) { codecs_.push_back(codec); }
virtual void AddOrReplaceCodec(const C& codec) { void AddOrReplaceCodec(const C& codec) {
for (typename std::vector<C>::iterator iter = codecs_.begin(); for (typename std::vector<C>::iterator iter = codecs_.begin();
iter != codecs_.end(); ++iter) { iter != codecs_.end(); ++iter) {
if (iter->id == codec.id) { if (iter->id == codec.id) {
@ -297,7 +297,7 @@ class MediaContentDescriptionImpl : public MediaContentDescription {
} }
AddCodec(codec); AddCodec(codec);
} }
virtual void AddCodecs(const std::vector<C>& codecs) { void AddCodecs(const std::vector<C>& codecs) {
typename std::vector<C>::const_iterator codec; typename std::vector<C>::const_iterator codec;
for (codec = codecs.begin(); codec != codecs.end(); ++codec) { for (codec = codecs.begin(); codec != codecs.end(); ++codec) {
AddCodec(*codec); AddCodec(*codec);