зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1601561 - Move parser names to static functions.;r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D57131 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
98a1b03ac0
Коммит
76dcc2f02b
|
@ -21,6 +21,11 @@ namespace mozilla {
|
||||||
|
|
||||||
using mozilla::LogLevel;
|
using mozilla::LogLevel;
|
||||||
|
|
||||||
|
const std::string& HybridSdpParser::ParserName() {
|
||||||
|
const static std::string PARSER_NAME = "hybrid";
|
||||||
|
return PARSER_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
HybridSdpParser::HybridSdpParser()
|
HybridSdpParser::HybridSdpParser()
|
||||||
: mStrictSuccess(SdpPref::StrictSuccess()),
|
: mStrictSuccess(SdpPref::StrictSuccess()),
|
||||||
mPrimary(SdpPref::Primary()),
|
mPrimary(SdpPref::Primary()),
|
||||||
|
@ -80,6 +85,4 @@ auto HybridSdpParser::Parse(const std::string& aText)
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string HybridSdpParser::PARSER_NAME = "hybrid";
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -16,11 +16,13 @@ namespace mozilla {
|
||||||
// preference flags. Additionally it handles collecting telemetry and fallback
|
// preference flags. Additionally it handles collecting telemetry and fallback
|
||||||
// behavior between the parsers.
|
// behavior between the parsers.
|
||||||
class HybridSdpParser : public SdpParser {
|
class HybridSdpParser : public SdpParser {
|
||||||
|
static const std::string& ParserName();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HybridSdpParser();
|
HybridSdpParser();
|
||||||
virtual ~HybridSdpParser() = default;
|
virtual ~HybridSdpParser() = default;
|
||||||
|
|
||||||
auto Name() const -> const std::string& override { return PARSER_NAME; }
|
auto Name() const -> const std::string& override { return ParserName(); }
|
||||||
auto Parse(const std::string& aText)
|
auto Parse(const std::string& aText)
|
||||||
-> UniquePtr<SdpParser::Results> override;
|
-> UniquePtr<SdpParser::Results> override;
|
||||||
|
|
||||||
|
@ -29,7 +31,6 @@ class HybridSdpParser : public SdpParser {
|
||||||
const UniquePtr<SdpParser> mPrimary;
|
const UniquePtr<SdpParser> mPrimary;
|
||||||
const Maybe<UniquePtr<SdpParser>> mSecondary;
|
const Maybe<UniquePtr<SdpParser>> mSecondary;
|
||||||
const Maybe<UniquePtr<SdpParser>> mFailover;
|
const Maybe<UniquePtr<SdpParser>> mFailover;
|
||||||
static const std::string PARSER_NAME;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -17,9 +17,10 @@
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
static const std::string& WEBRTC_SDP_NAME = "WEBRTCSDP";
|
const std::string& RsdparsaSdpParser::ParserName() {
|
||||||
|
static const std::string& WEBRTC_SDP_NAME = "WEBRTCSDP";
|
||||||
const std::string& RsdparsaSdpParser::Name() const { return WEBRTC_SDP_NAME; }
|
return WEBRTC_SDP_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
UniquePtr<SdpParser::Results> RsdparsaSdpParser::Parse(
|
UniquePtr<SdpParser::Results> RsdparsaSdpParser::Parse(
|
||||||
const std::string& aText) {
|
const std::string& aText) {
|
||||||
|
@ -67,7 +68,7 @@ UniquePtr<SdpParser::Results> RsdparsaSdpParser::Parse(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RsdparsaSdpParser::IsNamed(const std::string& aName) {
|
bool RsdparsaSdpParser::IsNamed(const std::string& aName) {
|
||||||
return aName == WEBRTC_SDP_NAME;
|
return aName == ParserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -17,11 +17,13 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class RsdparsaSdpParser final : public SdpParser {
|
class RsdparsaSdpParser final : public SdpParser {
|
||||||
|
static const std::string& ParserName();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RsdparsaSdpParser() = default;
|
RsdparsaSdpParser() = default;
|
||||||
virtual ~RsdparsaSdpParser() = default;
|
virtual ~RsdparsaSdpParser() = default;
|
||||||
|
|
||||||
const std::string& Name() const override;
|
const std::string& Name() const override { return ParserName(); }
|
||||||
|
|
||||||
UniquePtr<SdpParser::Results> Parse(const std::string& text) override;
|
UniquePtr<SdpParser::Results> Parse(const std::string& text) override;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ extern "C" {
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
static const std::string SIPCC_NAME = "SIPCC";
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void sipcc_sdp_parser_results_handler(void* context, uint32_t line,
|
void sipcc_sdp_parser_results_handler(void* context, uint32_t line,
|
||||||
|
@ -27,7 +25,10 @@ void sipcc_sdp_parser_results_handler(void* context, uint32_t line,
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
||||||
const std::string& SipccSdpParser::Name() const { return SIPCC_NAME; }
|
const std::string& SipccSdpParser::ParserName() {
|
||||||
|
static const std::string SIPCC_NAME = "SIPCC";
|
||||||
|
return SIPCC_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
UniquePtr<SdpParser::Results> SipccSdpParser::Parse(const std::string& aText) {
|
UniquePtr<SdpParser::Results> SipccSdpParser::Parse(const std::string& aText) {
|
||||||
UniquePtr<InternalResults> results(new InternalResults(Name()));
|
UniquePtr<InternalResults> results(new InternalResults(Name()));
|
||||||
|
@ -81,7 +82,7 @@ UniquePtr<SdpParser::Results> SipccSdpParser::Parse(const std::string& aText) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SipccSdpParser::IsNamed(const std::string& aName) {
|
bool SipccSdpParser::IsNamed(const std::string& aName) {
|
||||||
return aName == SIPCC_NAME;
|
return aName == ParserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -17,11 +17,13 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
class SipccSdpParser final : public SdpParser {
|
class SipccSdpParser final : public SdpParser {
|
||||||
|
static const std::string& ParserName();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SipccSdpParser() = default;
|
SipccSdpParser() = default;
|
||||||
virtual ~SipccSdpParser() = default;
|
virtual ~SipccSdpParser() = default;
|
||||||
|
|
||||||
const std::string& Name() const override;
|
const std::string& Name() const override { return ParserName(); }
|
||||||
|
|
||||||
UniquePtr<SdpParser::Results> Parse(const std::string& aText) override;
|
UniquePtr<SdpParser::Results> Parse(const std::string& aText) override;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче