| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_BASE_FILEROTATINGSTREAM_H_ | 11 #ifndef WEBRTC_BASE_FILEROTATINGSTREAM_H_ |
| 12 #define WEBRTC_BASE_FILEROTATINGSTREAM_H_ | 12 #define WEBRTC_BASE_FILEROTATINGSTREAM_H_ |
| 13 | 13 |
| 14 #include <memory> |
| 14 #include <string> | 15 #include <string> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "webrtc/base/constructormagic.h" | 18 #include "webrtc/base/constructormagic.h" |
| 18 #include "webrtc/base/stream.h" | 19 #include "webrtc/base/stream.h" |
| 19 | 20 |
| 20 namespace rtc { | 21 namespace rtc { |
| 21 | 22 |
| 22 // FileRotatingStream writes to a file in the directory specified in the | 23 // FileRotatingStream writes to a file in the directory specified in the |
| 23 // constructor. It rotates the files once the current file is full. The | 24 // constructor. It rotates the files once the current file is full. The |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Returns a list of file names in the directory beginning with the prefix. | 104 // Returns a list of file names in the directory beginning with the prefix. |
| 104 std::vector<std::string> GetFilesWithPrefix() const; | 105 std::vector<std::string> GetFilesWithPrefix() const; |
| 105 // Private version of GetFilePath. | 106 // Private version of GetFilePath. |
| 106 std::string GetFilePath(size_t index, size_t num_files) const; | 107 std::string GetFilePath(size_t index, size_t num_files) const; |
| 107 | 108 |
| 108 const std::string dir_path_; | 109 const std::string dir_path_; |
| 109 const std::string file_prefix_; | 110 const std::string file_prefix_; |
| 110 const Mode mode_; | 111 const Mode mode_; |
| 111 | 112 |
| 112 // FileStream is used to write to the current file. | 113 // FileStream is used to write to the current file. |
| 113 scoped_ptr<FileStream> file_stream_; | 114 std::unique_ptr<FileStream> file_stream_; |
| 114 // Convenience storage for file names so we don't generate them over and over. | 115 // Convenience storage for file names so we don't generate them over and over. |
| 115 std::vector<std::string> file_names_; | 116 std::vector<std::string> file_names_; |
| 116 size_t max_file_size_; | 117 size_t max_file_size_; |
| 117 size_t current_file_index_; | 118 size_t current_file_index_; |
| 118 // The rotation index indicates the index of the file that will be | 119 // The rotation index indicates the index of the file that will be |
| 119 // deleted first on rotation. Indices lower than this index will be rotated. | 120 // deleted first on rotation. Indices lower than this index will be rotated. |
| 120 size_t rotation_index_; | 121 size_t rotation_index_; |
| 121 // Number of bytes written to current file. We need this because with | 122 // Number of bytes written to current file. We need this because with |
| 122 // buffering the file size read from disk might not be accurate. | 123 // buffering the file size read from disk might not be accurate. |
| 123 size_t current_bytes_written_; | 124 size_t current_bytes_written_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 164 |
| 164 const size_t max_total_log_size_; | 165 const size_t max_total_log_size_; |
| 165 size_t num_rotations_; | 166 size_t num_rotations_; |
| 166 | 167 |
| 167 RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingStream); | 168 RTC_DISALLOW_COPY_AND_ASSIGN(CallSessionFileRotatingStream); |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 } // namespace rtc | 171 } // namespace rtc |
| 171 | 172 |
| 172 #endif // WEBRTC_BASE_FILEROTATINGSTREAM_H_ | 173 #endif // WEBRTC_BASE_FILEROTATINGSTREAM_H_ |
| OLD | NEW |