RtcEventLog::Create() no longer a friend of RtcEventLogImpl
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 <eladalon@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19876}
diff --git a/logging/rtc_event_log/rtc_event_log.cc b/logging/rtc_event_log/rtc_event_log.cc
index c36afaf..da4b41e 100644
--- a/logging/rtc_event_log/rtc_event_log.cc
+++ b/logging/rtc_event_log/rtc_event_log.cc
@@ -96,12 +96,10 @@
std::unique_ptr<T> resource_;
std::function<void(std::unique_ptr<T>)> handler_;
};
-} // namespace
class RtcEventLogImpl final : public RtcEventLog {
- friend std::unique_ptr<RtcEventLog> RtcEventLog::Create();
-
public:
+ RtcEventLogImpl();
~RtcEventLogImpl() override;
bool StartLogging(const std::string& file_name,
@@ -143,8 +141,6 @@
void StartLoggingInternal(std::unique_ptr<FileWrapper> file,
int64_t max_size_bytes);
- RtcEventLogImpl(); // Creation is done by RtcEventLog::Create.
-
void StoreEvent(std::unique_ptr<rtclog::Event> event);
void LogProbeResult(int id,
rtclog::BweProbeResult::ResultType result,
@@ -186,11 +182,6 @@
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 @@
return rtclog::BweProbeResult::SUCCESS;
}
-} // namespace
-
RtcEventLogImpl::RtcEventLogImpl()
: file_(FileWrapper::Create()),
max_size_bytes_(std::numeric_limits<decltype(max_size_bytes_)>::max()),
@@ -804,6 +793,8 @@
RTC_DCHECK(!file_->is_open());
}
+} // namespace
+
#endif // ENABLE_RTC_EVENT_LOG
// RtcEventLog member functions.
@@ -816,9 +807,9 @@
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<RtcEventLog>(new RtcEventLogNullImpl());
+ return CreateNull();
}
- return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl());
+ return rtc::MakeUnique<RtcEventLogImpl>();
#else
return CreateNull();
#endif // ENABLE_RTC_EVENT_LOG