| Index: net/base/file_stream.h
|
| diff --git a/net/base/file_stream.h b/net/base/file_stream.h
|
| index 5e07adcf6a703714a5919dfd2ad0689bc7b92e35..60b33bce752cd3fa67ee5fc9f910d474c878e212 100644
|
| --- a/net/base/file_stream.h
|
| +++ b/net/base/file_stream.h
|
| @@ -20,6 +20,29 @@ class FilePath;
|
|
|
| namespace net {
|
|
|
| +enum RecordingClass {
|
| + RECORDING_CLASS_NONE = 0,
|
| + RECORDING_CLASS_DOWNLOADS = 1,
|
| + // Add more flags here as necessary. Max 31.
|
| + RECORDING_CLASS_MAX,
|
| +};
|
| +
|
| +enum FileErrorTypes {
|
| + FILE_ERROR_TYPES_IS_NOT_OPEN = 0,
|
| + FILE_ERROR_TYPES_OPEN,
|
| + FILE_ERROR_TYPES_WRITE,
|
| + FILE_ERROR_TYPES_READ,
|
| + FILE_ERROR_TYPES_SEEK,
|
| + FILE_ERROR_TYPES_FLUSH,
|
| + FILE_ERROR_TYPES_SET_EOF,
|
| + FILE_ERROR_TYPES_GET_SIZE,
|
| + FILE_ERROR_TYPES_COUNT,
|
| +};
|
| +
|
| +void EnableRecordingForClass(int class_flags);
|
| +
|
| +void RecordFileError(int error, FileErrorTypes type, int class_flags);
|
| +
|
| // TODO(darin): Move this to a more generic location.
|
| // This explicit mapping matches both FILE_ on Windows and SEEK_ on Linux.
|
| enum Whence {
|
| @@ -31,6 +54,7 @@ enum Whence {
|
| class NET_API FileStream {
|
| public:
|
| FileStream();
|
| + explicit FileStream(int class_flags);
|
|
|
| // Construct a FileStream with an existing file handle and opening flags.
|
| // |file| is valid file handle.
|
| @@ -40,6 +64,14 @@ class NET_API FileStream {
|
| // is destructed.
|
| FileStream(base::PlatformFile file, int flags);
|
|
|
| + // Construct a FileStream with an existing file handle and opening flags.
|
| + // |file| is valid file handle.
|
| + // |flags| is a bitfield of base::PlatformFileFlags when the file handle was
|
| + // opened.
|
| + // The already opened file will not be automatically closed when FileStream
|
| + // is destructed.
|
| + FileStream(base::PlatformFile file, int flags, int class_flags);
|
| +
|
| ~FileStream();
|
|
|
| // Call this method to close the FileStream. It is OK to call Close
|
| @@ -132,6 +164,8 @@ class NET_API FileStream {
|
| // This method should not be called if the stream was opened READ_ONLY.
|
| int Flush();
|
|
|
| + void EnableRecording(bool enable, int class_flags);
|
| +
|
| private:
|
| class AsyncContext;
|
| friend class AsyncContext;
|
| @@ -143,6 +177,7 @@ class NET_API FileStream {
|
| base::PlatformFile file_;
|
| int open_flags_;
|
| bool auto_closed_;
|
| + int class_flags_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FileStream);
|
| };
|
|
|