From 2782904c56ef1eae627da4984afb454cf24fc391 Mon Sep 17 00:00:00 2001 From: Elad Alon Date: Fri, 15 Sep 2017 14:49:55 +0200 Subject: [PATCH] RtcEventLog::Create() no longer a friend of RtcEventLogImpl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By making RtcEventLogImpl's ctor public, we remove the necessity to make the function a friend. Visibility of RtcEventLogImpl is still limited to the .cc file. BUG=webrtc:8111 Change-Id: I774d2e93620a8d9f24299ef2a94f7593b490839d Reviewed-on: https://webrtc-review.googlesource.com/1237 Commit-Queue: Elad Alon Reviewed-by: Björn Terelius Cr-Commit-Position: refs/heads/master@{#19876} --- logging/rtc_event_log/rtc_event_log.cc | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/logging/rtc_event_log/rtc_event_log.cc b/logging/rtc_event_log/rtc_event_log.cc index c36afaf4e7..da4b41e340 100644 --- a/logging/rtc_event_log/rtc_event_log.cc +++ b/logging/rtc_event_log/rtc_event_log.cc @@ -96,12 +96,10 @@ class ResourceOwningTask final : public rtc::QueuedTask { std::unique_ptr resource_; std::function)> handler_; }; -} // namespace class RtcEventLogImpl final : public RtcEventLog { - friend std::unique_ptr RtcEventLog::Create(); - public: + RtcEventLogImpl(); ~RtcEventLogImpl() override; bool StartLogging(const std::string& file_name, @@ -143,8 +141,6 @@ class RtcEventLogImpl final : public RtcEventLog { void StartLoggingInternal(std::unique_ptr file, int64_t max_size_bytes); - RtcEventLogImpl(); // Creation is done by RtcEventLog::Create. - void StoreEvent(std::unique_ptr event); void LogProbeResult(int id, rtclog::BweProbeResult::ResultType result, @@ -186,11 +182,6 @@ class RtcEventLogImpl final : public RtcEventLog { RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogImpl); }; -namespace { -// The functions in this namespace convert enums from the runtime format -// that the rest of the WebRtc project can use, to the corresponding -// serialized enum which is defined by the protobuf. - rtclog::VideoReceiveConfig_RtcpMode ConvertRtcpMode(RtcpMode rtcp_mode) { switch (rtcp_mode) { case RtcpMode::kCompound: @@ -233,8 +224,6 @@ rtclog::BweProbeResult::ResultType ConvertProbeResultType( return rtclog::BweProbeResult::SUCCESS; } -} // namespace - RtcEventLogImpl::RtcEventLogImpl() : file_(FileWrapper::Create()), max_size_bytes_(std::numeric_limits::max()), @@ -804,6 +793,8 @@ void RtcEventLogImpl::StopLogFile(int64_t stop_time) { RTC_DCHECK(!file_->is_open()); } +} // namespace + #endif // ENABLE_RTC_EVENT_LOG // RtcEventLog member functions. @@ -816,9 +807,9 @@ std::unique_ptr RtcEventLog::Create() { LOG(LS_WARNING) << "Denied creation of additional WebRTC event logs. " << count - 1 << " logs open already."; std::atomic_fetch_sub(&rtc_event_log_count, 1); - return std::unique_ptr(new RtcEventLogNullImpl()); + return CreateNull(); } - return std::unique_ptr(new RtcEventLogImpl()); + return rtc::MakeUnique(); #else return CreateNull(); #endif // ENABLE_RTC_EVENT_LOG