From 447b9f3fde1fa733ad3a1565f996e16af248dfc9 Mon Sep 17 00:00:00 2001 From: Ivan Rosales Date: Thu, 17 Nov 2022 12:15:31 -0800 Subject: [PATCH] Unvirtualize more wasteful functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Henrik Boström Cr-Commit-Position: refs/heads/main@{#38713} --- pc/session_description.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pc/session_description.h b/pc/session_description.h index c66c583d6b..f68e044db2 100644 --- a/pc/session_description.h +++ b/pc/session_description.h @@ -272,10 +272,10 @@ class MediaContentDescriptionImpl : public MediaContentDescription { typedef C CodecType; // Codecs should be in preference order (most preferred codec first). - virtual const std::vector& codecs() const { return codecs_; } - virtual void set_codecs(const std::vector& codecs) { codecs_ = codecs; } + const std::vector& codecs() const { return codecs_; } + void set_codecs(const std::vector& codecs) { codecs_ = codecs; } bool has_codecs() const override { return !codecs_.empty(); } - virtual bool HasCodec(int id) { + bool HasCodec(int id) { bool found = false; for (typename std::vector::iterator iter = codecs_.begin(); iter != codecs_.end(); ++iter) { @@ -286,8 +286,8 @@ class MediaContentDescriptionImpl : public MediaContentDescription { } return found; } - virtual void AddCodec(const C& codec) { codecs_.push_back(codec); } - virtual void AddOrReplaceCodec(const C& codec) { + void AddCodec(const C& codec) { codecs_.push_back(codec); } + void AddOrReplaceCodec(const C& codec) { for (typename std::vector::iterator iter = codecs_.begin(); iter != codecs_.end(); ++iter) { if (iter->id == codec.id) { @@ -297,7 +297,7 @@ class MediaContentDescriptionImpl : public MediaContentDescription { } AddCodec(codec); } - virtual void AddCodecs(const std::vector& codecs) { + void AddCodecs(const std::vector& codecs) { typename std::vector::const_iterator codec; for (codec = codecs.begin(); codec != codecs.end(); ++codec) { AddCodec(*codec);