aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortommi <tommi@webrtc.org>2016-01-13 08:12:00 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-13 16:12:07 +0000
commitfca54f41ad1b5b2189d123fe8e97f3ff9b457336 (patch)
tree133e3f50719f207d8d9e85ec948d2d59d5dd5671
parent09d944f82db00686dc9f364628f906d3cc106707 (diff)
downloadwebrtc-fca54f41ad1b5b2189d123fe8e97f3ff9b457336.tar.gz
Revert of Use an explicit identifier in Config (patchset #4 id:60001 of https://codereview.webrtc.org/1538643004/ )
Reason for revert: Reverting due to problem with roll: /b/build/slave/linux/build/src/buildtools/linux64/gn gen //out/Release '--args=ffmpeg_branding="Chrome" proprietary_codecs=true is_debug=false is_component_build=false use_goma=true goma_dir="/b/build/goma" symbol_level=1 dcheck_always_on=true' --check --runtime-deps-list-file=/b/build/slave/linux/build/src/out/Release/runtime_deps -> returned 1 ERROR at //third_party/webrtc/BUILD.gn:245:18: Item not found configs -= [ "//build/config/clang:find_bad_constructs" ] ^----------------------------------------- You were trying to remove "//build/config/clang:find_bad_constructs" from the list but it wasn't there. GN gen failed: 1 step returned non-zero exit code: 1 @@@STEP_FAILURE@@@ Original issue's description: > Use an explicit identifier in Config > > This let's us use them to configure them when using WebRTC as an external library. One use case where this is necessary is in the Android OS. > > Committed: https://crrev.com/25249d92d3cf105bcc7b684c8924ccdbc9afcb93 > Cr-Commit-Position: refs/heads/master@{#11231} TBR=henrik.lundin@webrtc.org,stefan@webrtc.org,tommi@chromium.org,aluebs@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.webrtc.org/1586563003 Cr-Commit-Position: refs/heads/master@{#11239}
-rwxr-xr-xtalk/libjingle.gyp6
-rw-r--r--webrtc/BUILD.gn6
-rw-r--r--webrtc/common.h27
-rw-r--r--webrtc/config.h4
-rw-r--r--webrtc/modules/audio_processing/include/audio_processing.h6
-rw-r--r--webrtc/modules/video_coding/codecs/vp8/temporal_layers.h3
-rw-r--r--webrtc/test/common_unittest.cc3
7 files changed, 7 insertions, 48 deletions
diff --git a/talk/libjingle.gyp b/talk/libjingle.gyp
index 6e0f8a3424..da7f80b60d 100755
--- a/talk/libjingle.gyp
+++ b/talk/libjingle.gyp
@@ -712,16 +712,10 @@
'include_dirs': [
'<(DEPTH)/testing/gtest/include',
],
- 'include_dirs!': [
- '<(DEPTH)/webrtc',
- ],
'direct_dependent_settings': {
'include_dirs': [
'<(DEPTH)/testing/gtest/include',
],
- 'include_dirs!': [
- '<(DEPTH)/webrtc',
- ],
},
'sources': [
'session/media/audiomonitor.cc',
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index c013b8c806..b26d29f2ee 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -238,12 +238,6 @@ source_set("webrtc_common") {
configs += [ ":common_config" ]
public_configs = [ ":common_inherited_config" ]
-
- if (is_clang) {
- # Suppress warnings from Chrome's Clang plugins.
- # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
- configs -= [ "//build/config/clang:find_bad_constructs" ]
- }
}
source_set("gtest_prod") {
diff --git a/webrtc/common.h b/webrtc/common.h
index d705d4b8ed..dda045ee6c 100644
--- a/webrtc/common.h
+++ b/webrtc/common.h
@@ -17,23 +17,6 @@
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 @@ class Config {
}
private:
+ typedef void* OptionIdentifier;
+
struct BaseOption {
virtual ~BaseOption() {}
};
@@ -91,9 +76,11 @@ class Config {
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 @@ class Config {
return def;
}
- typedef std::map<ConfigOptionID, BaseOption*> OptionMap;
+ typedef std::map<OptionIdentifier, BaseOption*> OptionMap;
OptionMap options_;
// RTC_DISALLOW_COPY_AND_ASSIGN
diff --git a/webrtc/config.h b/webrtc/config.h
index 06460ae359..45a2ece416 100644
--- a/webrtc/config.h
+++ b/webrtc/config.h
@@ -16,7 +16,6 @@
#include <string>
#include <vector>
-#include "webrtc/common.h"
#include "webrtc/common_types.h"
#include "webrtc/typedefs.h"
@@ -129,7 +128,6 @@ struct VideoEncoderConfig {
struct NetEqCapacityConfig {
NetEqCapacityConfig() : enabled(false), capacity(0) {}
explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {}
- static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig;
bool enabled;
int capacity;
};
@@ -137,14 +135,12 @@ struct NetEqCapacityConfig {
struct NetEqFastAccelerate {
NetEqFastAccelerate() : enabled(false) {}
explicit NetEqFastAccelerate(bool value) : enabled(value) {}
- static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate;
bool enabled;
};
struct VoicePacing {
VoicePacing() : enabled(false) {}
explicit VoicePacing(bool value) : enabled(value) {}
- static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing;
bool enabled;
};
diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h
index 9a3a4b32d5..5dd63ebc30 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -65,7 +65,6 @@ class VoiceDetection;
struct ExtendedFilter {
ExtendedFilter() : enabled(false) {}
explicit ExtendedFilter(bool enabled) : enabled(enabled) {}
- static const ConfigOptionID identifier = ConfigOptionID::kExtendedFilter;
bool enabled;
};
@@ -77,7 +76,6 @@ struct ExtendedFilter {
struct DelayAgnostic {
DelayAgnostic() : enabled(false) {}
explicit DelayAgnostic(bool enabled) : enabled(enabled) {}
- static const ConfigOptionID identifier = ConfigOptionID::kDelayAgnostic;
bool enabled;
};
@@ -98,7 +96,6 @@ struct ExperimentalAgc {
: enabled(enabled), startup_min_volume(kAgcStartupMinVolume) {}
ExperimentalAgc(bool enabled, int startup_min_volume)
: enabled(enabled), startup_min_volume(startup_min_volume) {}
- static const ConfigOptionID identifier = ConfigOptionID::kExperimentalAgc;
bool enabled;
int startup_min_volume;
};
@@ -108,7 +105,6 @@ struct ExperimentalAgc {
struct ExperimentalNs {
ExperimentalNs() : enabled(false) {}
explicit ExperimentalNs(bool enabled) : enabled(enabled) {}
- static const ConfigOptionID identifier = ConfigOptionID::kExperimentalNs;
bool enabled;
};
@@ -131,7 +127,6 @@ struct Beamforming {
: enabled(enabled),
array_geometry(array_geometry),
target_direction(target_direction) {}
- static const ConfigOptionID identifier = ConfigOptionID::kBeamforming;
const bool enabled;
const std::vector<Point> array_geometry;
const SphericalPointf target_direction;
@@ -146,7 +141,6 @@ struct Beamforming {
struct Intelligibility {
Intelligibility() : enabled(false) {}
explicit Intelligibility(bool enabled) : enabled(enabled) {}
- static const ConfigOptionID identifier = ConfigOptionID::kIntelligibility;
bool enabled;
};
diff --git a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h
index 47112c64aa..7fe03a4da8 100644
--- a/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h
+++ b/webrtc/modules/video_coding/codecs/vp8/temporal_layers.h
@@ -14,7 +14,6 @@
#include "vpx/vpx_encoder.h"
-#include "webrtc/common.h"
#include "webrtc/common_video/include/video_image.h"
#include "webrtc/typedefs.h"
@@ -31,8 +30,6 @@ class TemporalLayers {
virtual ~Factory() {}
virtual TemporalLayers* Create(int temporal_layers,
uint8_t initial_tl0_pic_idx) const;
- static const ConfigOptionID identifier =
- ConfigOptionID::kTemporalLayersFactory;
};
virtual ~TemporalLayers() {}
diff --git a/webrtc/test/common_unittest.cc b/webrtc/test/common_unittest.cc
index a239dade73..082c18c2c7 100644
--- a/webrtc/test/common_unittest.cc
+++ b/webrtc/test/common_unittest.cc
@@ -15,7 +15,6 @@ namespace webrtc {
namespace {
struct MyExperiment {
- static const ConfigOptionID identifier = ConfigOptionID::kMyExperimentForTest;
static const int kDefaultFactor;
static const int kDefaultOffset;
@@ -57,8 +56,6 @@ TEST(Config, SetNullSetsTheOptionBackToDefault) {
}
struct Algo1_CostFunction {
- static const ConfigOptionID identifier =
- ConfigOptionID::kAlgo1CostFunctionForTest;
Algo1_CostFunction() {}
virtual int cost(int x) const {