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

Unified Diff: webrtc/base/filerotatingstream.cc

Issue 1245143005: Remove CircularFileStream / replace it with CallSessionFileRotatingStream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add GetSize to FileRotatingStream Created 5 years, 5 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 | « webrtc/base/filerotatingstream.h ('k') | webrtc/base/filerotatingstream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/filerotatingstream.cc
diff --git a/webrtc/base/filerotatingstream.cc b/webrtc/base/filerotatingstream.cc
index 3fd60ac8234ebea291b89fb72daf69bd188ab35f..f2a6def013306faee5a209e9ab750666100c2bfc 100644
--- a/webrtc/base/filerotatingstream.cc
+++ b/webrtc/base/filerotatingstream.cc
@@ -177,6 +177,26 @@ bool FileRotatingStream::Flush() {
return file_stream_->Flush();
}
+bool FileRotatingStream::GetSize(size_t* size) const {
+ if (mode_ != kRead) {
+ // Not possible to get accurate size on disk when writing because of
+ // potential buffering.
+ return false;
+ }
+ DCHECK(size);
+ *size = 0;
+ size_t total_size = 0;
+ for (auto file_name : file_names_) {
+ Pathname pathname(file_name);
+ size_t file_size = 0;
+ if (Filesystem::GetFileSize(file_name, &file_size)) {
+ total_size += file_size;
+ }
+ }
+ *size = total_size;
+ return true;
+}
+
void FileRotatingStream::Close() {
CloseCurrentFile();
}
« no previous file with comments | « webrtc/base/filerotatingstream.h ('k') | webrtc/base/filerotatingstream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698