Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: webrtc/call/rtc_event_log_helper_thread.cc

Issue 1997393002: Improved error checking for file errors in RtcEventLog. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments from pbos Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/rtc_event_log_helper_thread.cc
diff --git a/webrtc/call/rtc_event_log_helper_thread.cc b/webrtc/call/rtc_event_log_helper_thread.cc
index a9aa85144f03da4b825308f618f50e6d0d08e612..93343129a1734d68b3179db049e9fdcbf5777a0b 100644
--- a/webrtc/call/rtc_event_log_helper_thread.cc
+++ b/webrtc/call/rtc_event_log_helper_thread.cc
@@ -143,7 +143,12 @@ void RtcEventLogHelperThread::StartLogFile() {
}
// Write to file.
- file_->Write(output_string_.data(), output_string_.size());
+ if (!file_->Write(output_string_.data(), output_string_.size())) {
+ LOG(LS_ERROR) << "FileWrapper failed to write WebRtcEventLog file.";
+ // The current FileWrapper implementation closes the file on error.
+ RTC_DCHECK(!file_->Open());
+ return;
+ }
written_bytes_ += output_string_.size();
// Free the allocated memory since we probably won't need this amount of
@@ -181,12 +186,13 @@ void RtcEventLogHelperThread::LogToFile() {
}
// Write string to file.
- file_->Write(output_string_.data(), output_string_.size());
- written_bytes_ += output_string_.size();
-
- if (!file_->Open()) {
- LOG(LS_WARNING) << "WebRTC event log file closed by FileWrapper.";
+ if (!file_->Write(output_string_.data(), output_string_.size())) {
+ LOG(LS_ERROR) << "FileWrapper failed to write WebRtcEventLog file.";
+ // The current FileWrapper implementation closes the file on error.
+ RTC_DCHECK(!file_->Open());
+ return;
}
+ written_bytes_ += output_string_.size();
// We want to stop logging if we have reached the file size limit. We also
// want to stop logging if the remaining events are more recent than the
@@ -210,7 +216,11 @@ void RtcEventLogHelperThread::StopLogFile() {
if (written_bytes_ + static_cast<int64_t>(output_string_.size()) <=
max_size_bytes_) {
- file_->Write(output_string_.data(), output_string_.size());
+ if (!file_->Write(output_string_.data(), output_string_.size())) {
+ LOG(LS_ERROR) << "FileWrapper failed to write WebRtcEventLog file.";
+ // The current FileWrapper implementation closes the file on error.
+ RTC_DCHECK(!file_->Open());
+ }
written_bytes_ += output_string_.size();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698