Reland "Trim down FileWrapper class to be merely a wrapper owning a FILE*"

This is a reland of 80b95de7651caa0cfeb684ffc200860989f667dc

Original change's description:
> Trim down FileWrapper class to be merely a wrapper owning a FILE*
> 
> Bug: webrtc:6463
> Change-Id: If71e2f3a75dc1863bc805ab71de1e2d33294f805
> Reviewed-on: https://webrtc-review.googlesource.com/c/117881
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Reviewed-by: Alex Loiko <aleloi@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#26311}

Bug: webrtc:6463
Change-Id: I12154ef65744c1b7811974a1d871e05ed3fbbc27
Reviewed-on: https://webrtc-review.googlesource.com/c/118660
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26337}
This commit is contained in:
Niels Möller
2019-01-21 11:59:10 +01:00
committed by Commit Bot
parent 700615fb1c
commit 5a6ae02e90
13 changed files with 229 additions and 345 deletions

View File

@ -67,14 +67,13 @@ class DebugDumpWriterImpl final : public DebugDumpWriter {
#endif
private:
std::unique_ptr<FileWrapper> dump_file_;
FileWrapper dump_file_;
};
DebugDumpWriterImpl::DebugDumpWriterImpl(FILE* file_handle)
: dump_file_(FileWrapper::Create()) {
DebugDumpWriterImpl::DebugDumpWriterImpl(FILE* file_handle) {
#if WEBRTC_ENABLE_PROTOBUF
dump_file_->OpenFromFileHandle(file_handle);
RTC_CHECK(dump_file_->is_open());
dump_file_ = FileWrapper(file_handle);
RTC_CHECK(dump_file_.is_open());
#else
RTC_NOTREACHED();
#endif
@ -110,7 +109,7 @@ void DebugDumpWriterImpl::DumpNetworkMetrics(
*metrics.uplink_recoverable_packet_loss_fraction);
}
DumpEventToFile(event, dump_file_.get());
DumpEventToFile(event, &dump_file_);
#endif // WEBRTC_ENABLE_PROTOBUF
}
@ -143,7 +142,7 @@ void DebugDumpWriterImpl::DumpEncoderRuntimeConfig(
if (config.num_channels)
dump_config->set_num_channels(*config.num_channels);
DumpEventToFile(event, dump_file_.get());
DumpEventToFile(event, &dump_file_);
#endif // WEBRTC_ENABLE_PROTOBUF
}
@ -157,7 +156,7 @@ void DebugDumpWriterImpl::DumpControllerManagerConfig(
event.set_type(Event::CONTROLLER_MANAGER_CONFIG);
event.mutable_controller_manager_config()->CopyFrom(
controller_manager_config);
DumpEventToFile(event, dump_file_.get());
DumpEventToFile(event, &dump_file_);
}
#endif // WEBRTC_ENABLE_PROTOBUF