| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. | 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
| 6 | 6 |
| 7 #ifndef NET_DISK_CACHE_FILE_H_ | 7 #ifndef NET_DISK_CACHE_FILE_H_ |
| 8 #define NET_DISK_CACHE_FILE_H_ | 8 #define NET_DISK_CACHE_FILE_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 | 13 |
| 14 class FilePath; | 14 class FilePath; |
| 15 | 15 |
| 16 namespace disk_cache { | 16 namespace disk_cache { |
| 17 | 17 |
| 18 // This interface is used to support asynchronous ReadData and WriteData calls. | 18 // This interface is used to support asynchronous ReadData and WriteData calls. |
| 19 class FileIOCallback { | 19 class FileIOCallback { |
| 20 public: | 20 public: |
| 21 virtual ~FileIOCallback() {} |
| 22 |
| 21 // Notified of the actual number of bytes read or written. This value is | 23 // Notified of the actual number of bytes read or written. This value is |
| 22 // negative if an error occurred. | 24 // negative if an error occurred. |
| 23 virtual void OnFileIOComplete(int bytes_copied) = 0; | 25 virtual void OnFileIOComplete(int bytes_copied) = 0; |
| 24 | |
| 25 virtual ~FileIOCallback() {} | |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // Simple wrapper around a file that allows asynchronous operations. | 28 // Simple wrapper around a file that allows asynchronous operations. |
| 29 class File : public base::RefCounted<File> { | 29 class File : public base::RefCounted<File> { |
| 30 friend class base::RefCounted<File>; | 30 friend class base::RefCounted<File>; |
| 31 public: | 31 public: |
| 32 File(); | 32 File(); |
| 33 // mixed_mode set to true enables regular synchronous operations for the file. | 33 // mixed_mode set to true enables regular synchronous operations for the file. |
| 34 explicit File(bool mixed_mode); | 34 explicit File(bool mixed_mode); |
| 35 | 35 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool mixed_; | 80 bool mixed_; |
| 81 base::PlatformFile platform_file_; // Regular, asynchronous IO handle. | 81 base::PlatformFile platform_file_; // Regular, asynchronous IO handle. |
| 82 base::PlatformFile sync_platform_file_; // Synchronous IO handle. | 82 base::PlatformFile sync_platform_file_; // Synchronous IO handle. |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(File); | 84 DISALLOW_COPY_AND_ASSIGN(File); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace disk_cache | 87 } // namespace disk_cache |
| 88 | 88 |
| 89 #endif // NET_DISK_CACHE_FILE_H_ | 89 #endif // NET_DISK_CACHE_FILE_H_ |
| OLD | NEW |