From 6daffe206d7a9f911c632a17cb697468ef0f31b1 Mon Sep 17 00:00:00 2001 From: kwiberg Date: Tue, 18 Apr 2017 01:26:40 -0700 Subject: [PATCH] Rename the webrtc_adm_linux* namespaces to webrtc::adm_linux* We shouldn't pollute the global namespace. BUG=webrtc:7484 Review-Url: https://codereview.webrtc.org/2818563003 Cr-Commit-Position: refs/heads/master@{#17734} --- .../linux/alsasymboltable_linux.cc | 6 ++-- .../linux/alsasymboltable_linux.h | 6 ++-- .../linux/audio_device_alsa_linux.cc | 4 +-- .../linux/audio_device_pulse_linux.cc | 7 +++-- .../linux/audio_mixer_manager_alsa_linux.cc | 4 +-- .../linux/audio_mixer_manager_pulse_linux.cc | 8 ++--- .../linux/latebindingsymboltable_linux.cc | 9 +++--- .../linux/latebindingsymboltable_linux.h | 31 ++++++++++--------- .../linux/pulseaudiosymboltable_linux.cc | 6 ++-- .../linux/pulseaudiosymboltable_linux.h | 6 ++-- 10 files changed, 49 insertions(+), 38 deletions(-) diff --git a/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc b/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc index a391590787..2459625692 100644 --- a/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc +++ b/webrtc/modules/audio_device/linux/alsasymboltable_linux.cc @@ -27,7 +27,8 @@ #include "webrtc/modules/audio_device/linux/alsasymboltable_linux.h" -namespace webrtc_adm_linux_alsa { +namespace webrtc { +namespace adm_linux_alsa { LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(AlsaSymbolTable, "libasound.so.2") #define X(sym) \ @@ -36,4 +37,5 @@ ALSA_SYMBOLS_LIST #undef X LATE_BINDING_SYMBOL_TABLE_DEFINE_END(AlsaSymbolTable) -} // namespace webrtc_adm_linux_alsa +} // namespace adm_linux_alsa +} // namespace webrtc diff --git a/webrtc/modules/audio_device/linux/alsasymboltable_linux.h b/webrtc/modules/audio_device/linux/alsasymboltable_linux.h index 82690c5007..14b016cf67 100644 --- a/webrtc/modules/audio_device/linux/alsasymboltable_linux.h +++ b/webrtc/modules/audio_device/linux/alsasymboltable_linux.h @@ -30,7 +30,8 @@ #include "webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h" -namespace webrtc_adm_linux_alsa { +namespace webrtc { +namespace adm_linux_alsa { // The ALSA symbols we need, as an X-Macro list. // This list must contain precisely every libasound function that is used in @@ -142,6 +143,7 @@ ALSA_SYMBOLS_LIST #undef X LATE_BINDING_SYMBOL_TABLE_DECLARE_END(AlsaSymbolTable) -} // namespace webrtc_adm_linux_alsa +} // namespace adm_linux_alsa +} // namespace webrtc #endif // WEBRTC_AUDIO_DEVICE_ALSASYMBOLTABLE_LINUX_H diff --git a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc index 3b8cf24773..defae6b680 100644 --- a/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc @@ -18,13 +18,13 @@ #include "webrtc/system_wrappers/include/sleep.h" #include "webrtc/system_wrappers/include/trace.h" -webrtc_adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; +webrtc::adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; // Accesses ALSA functions through our late-binding symbol table instead of // directly. This way we don't have to link to libasound, which means our binary // will work on systems that don't have it. #define LATE(sym) \ - LATESYM_GET(webrtc_adm_linux_alsa::AlsaSymbolTable, &AlsaSymbolTable, sym) + LATESYM_GET(webrtc::adm_linux_alsa::AlsaSymbolTable, &AlsaSymbolTable, sym) // Redefine these here to be able to do late-binding #undef snd_ctl_card_info_alloca diff --git a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc index a486ee5468..bbc6fadbbf 100644 --- a/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc @@ -17,13 +17,14 @@ #include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/system_wrappers/include/trace.h" -webrtc_adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; +webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; // Accesses Pulse functions through our late-binding symbol table instead of // directly. This way we don't have to link to libpulse, which means our binary // will work on systems that don't have it. -#define LATE(sym) \ - LATESYM_GET(webrtc_adm_linux_pulse::PulseAudioSymbolTable, &PaSymbolTable, sym) +#define LATE(sym) \ + LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, &PaSymbolTable, \ + sym) namespace webrtc { diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc index be5e17e14c..1a30fec274 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc @@ -13,13 +13,13 @@ #include "webrtc/modules/audio_device/linux/audio_mixer_manager_alsa_linux.h" #include "webrtc/system_wrappers/include/trace.h" -extern webrtc_adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; +extern webrtc::adm_linux_alsa::AlsaSymbolTable AlsaSymbolTable; // Accesses ALSA functions through our late-binding symbol table instead of // directly. This way we don't have to link to libalsa, which means our binary // will work on systems that don't have it. #define LATE(sym) \ - LATESYM_GET(webrtc_adm_linux_alsa::AlsaSymbolTable, &AlsaSymbolTable, sym) + LATESYM_GET(webrtc::adm_linux_alsa::AlsaSymbolTable, &AlsaSymbolTable, sym) namespace webrtc { diff --git a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc index f73a399c9d..a9b3d47936 100644 --- a/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc +++ b/webrtc/modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc @@ -14,14 +14,14 @@ #include "webrtc/system_wrappers/include/trace.h" #include "webrtc/base/checks.h" -extern webrtc_adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; +extern webrtc::adm_linux_pulse::PulseAudioSymbolTable PaSymbolTable; // Accesses Pulse functions through our late-binding symbol table instead of // directly. This way we don't have to link to libpulse, which means our // binary will work on systems that don't have it. -#define LATE(sym) \ - LATESYM_GET(webrtc_adm_linux_pulse::PulseAudioSymbolTable, \ - &PaSymbolTable, sym) +#define LATE(sym) \ + LATESYM_GET(webrtc::adm_linux_pulse::PulseAudioSymbolTable, &PaSymbolTable, \ + sym) namespace webrtc { diff --git a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc index bc5a3f818c..1052f86143 100644 --- a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc +++ b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.cc @@ -16,10 +16,8 @@ #include #endif -// TODO(grunell): Either put inside webrtc namespace or use webrtc:: instead. -using namespace webrtc; - -namespace webrtc_adm_linux { +namespace webrtc { +namespace adm_linux { inline static const char *GetDllError() { #ifdef WEBRTC_LINUX @@ -107,4 +105,5 @@ bool InternalLoadSymbols(DllHandle handle, return true; } -} // namespace webrtc_adm_linux +} // namespace adm_linux +} // namespace webrtc diff --git a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h index 4b3569cb95..d62f00a822 100644 --- a/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h +++ b/webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h @@ -22,7 +22,8 @@ // supports Linux and pure C symbols. // See talk/sound/pulseaudiosymboltable.(h|cc) for an example. -namespace webrtc_adm_linux { +namespace webrtc { +namespace adm_linux { #ifdef WEBRTC_LINUX typedef void *DllHandle; @@ -132,18 +133,19 @@ enum { ClassName##_SYMBOL_TABLE_INDEX_##sym, // This macro completes the header declaration. -#define LATE_BINDING_SYMBOL_TABLE_DECLARE_END(ClassName) \ - ClassName##_SYMBOL_TABLE_SIZE \ -}; \ -\ -extern const char ClassName##_kDllName[]; \ -extern const char *const \ - ClassName##_kSymbolNames[ClassName##_SYMBOL_TABLE_SIZE]; \ -\ -typedef ::webrtc_adm_linux::LateBindingSymbolTable \ - ClassName; +#define LATE_BINDING_SYMBOL_TABLE_DECLARE_END(ClassName) \ + ClassName##_SYMBOL_TABLE_SIZE \ + } \ + ; \ + \ + extern const char ClassName##_kDllName[]; \ + extern const char* const \ + ClassName##_kSymbolNames[ClassName##_SYMBOL_TABLE_SIZE]; \ + \ + typedef ::webrtc::adm_linux::LateBindingSymbolTable< \ + ClassName##_SYMBOL_TABLE_SIZE, ClassName##_kDllName, \ + ClassName##_kSymbolNames> \ + ClassName; // This macro must be invoked in a .cc file to define a previously-declared // symbol table class. @@ -170,6 +172,7 @@ const char *const ClassName##_kSymbolNames[ClassName##_SYMBOL_TABLE_SIZE] = { (*reinterpret_cast( \ (inst)->GetSymbol(LATESYM_INDEXOF(ClassName, sym)))) -} // namespace webrtc_adm_linux +} // namespace adm_linux +} // namespace webrtc #endif // WEBRTC_ADM_LATEBINDINGSYMBOLTABLE_LINUX_H diff --git a/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc b/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc index 1f1890a6d9..26a173d4b6 100644 --- a/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc +++ b/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.cc @@ -27,7 +27,8 @@ #include "webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.h" -namespace webrtc_adm_linux_pulse { +namespace webrtc { +namespace adm_linux_pulse { LATE_BINDING_SYMBOL_TABLE_DEFINE_BEGIN(PulseAudioSymbolTable, "libpulse.so.0") #define X(sym) \ @@ -36,4 +37,5 @@ PULSE_AUDIO_SYMBOLS_LIST #undef X LATE_BINDING_SYMBOL_TABLE_DEFINE_END(PulseAudioSymbolTable) -} // namespace webrtc_adm_linux_pulse +} // namespace adm_linux_pulse +} // namespace webrtc diff --git a/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.h b/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.h index 7f3ccabef5..f0d6d3858d 100644 --- a/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.h +++ b/webrtc/modules/audio_device/linux/pulseaudiosymboltable_linux.h @@ -30,7 +30,8 @@ #include "webrtc/modules/audio_device/linux/latebindingsymboltable_linux.h" -namespace webrtc_adm_linux_pulse { +namespace webrtc { +namespace adm_linux_pulse { // The PulseAudio symbols we need, as an X-Macro list. // This list must contain precisely every libpulse function that is used in @@ -99,6 +100,7 @@ PULSE_AUDIO_SYMBOLS_LIST #undef X LATE_BINDING_SYMBOL_TABLE_DECLARE_END(PulseAudioSymbolTable) -} // namespace webrtc_adm_linux_pulse +} // namespace adm_linux_pulse +} // namespace webrtc #endif // WEBRTC_AUDIO_DEVICE_PULSEAUDIOSYMBOLTABLE_LINUX_H