Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Unified Diff: webrtc/common.h

Issue 1586563003: Revert of Use an explicit identifier in Config (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/config.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common.h
diff --git a/webrtc/common.h b/webrtc/common.h
index d705d4b8ed12ea6efe357feec8e46bbd3ea8814b..dda045ee6c0ca3a64756a706f9a6417c774a1b35 100644
--- a/webrtc/common.h
+++ b/webrtc/common.h
@@ -16,23 +16,6 @@
#include "webrtc/base/basictypes.h"
namespace webrtc {
-
-// Only add new values to the end of the enumeration and never remove (only
-// deprecate) to maintain binary compatibility.
-enum class ConfigOptionID {
- kMyExperimentForTest,
- kAlgo1CostFunctionForTest,
- kTemporalLayersFactory,
- kNetEqCapacityConfig,
- kNetEqFastAccelerate,
- kVoicePacing,
- kExtendedFilter,
- kDelayAgnostic,
- kExperimentalAgc,
- kExperimentalNs,
- kBeamforming,
- kIntelligibility
-};
// Class Config is designed to ease passing a set of options across webrtc code.
// Options are identified by typename in order to avoid incorrect casts.
@@ -78,6 +61,8 @@
}
private:
+ typedef void* OptionIdentifier;
+
struct BaseOption {
virtual ~BaseOption() {}
};
@@ -91,9 +76,11 @@
T* value;
};
+ // Own implementation of rtti-subset to avoid depending on rtti and its costs.
template<typename T>
- static ConfigOptionID identifier() {
- return T::identifier;
+ static OptionIdentifier identifier() {
+ static char id_placeholder;
+ return &id_placeholder;
}
// Used to instantiate a default constructed object that doesn't needs to be
@@ -105,7 +92,7 @@
return def;
}
- typedef std::map<ConfigOptionID, BaseOption*> OptionMap;
+ typedef std::map<OptionIdentifier, BaseOption*> OptionMap;
OptionMap options_;
// RTC_DISALLOW_COPY_AND_ASSIGN
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698