| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // negative if an error occurred. | 22 // negative if an error occurred. |
| 23 virtual void OnFileIOComplete(int bytes_copied) = 0; | 23 virtual void OnFileIOComplete(int bytes_copied) = 0; |
| 24 | 24 |
| 25 virtual ~FileIOCallback() {} | 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() : init_(false), mixed_(false) {} | 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) : init_(false), mixed_(mixed_mode) {} | 34 explicit File(bool mixed_mode); |
| 35 | 35 |
| 36 // Initializes the object to use the passed in file instead of opening it with | 36 // Initializes the object to use the passed in file instead of opening it with |
| 37 // the Init() call. No asynchronous operations can be performed with this | 37 // the Init() call. No asynchronous operations can be performed with this |
| 38 // object. | 38 // object. |
| 39 explicit File(base::PlatformFile file); | 39 explicit File(base::PlatformFile file); |
| 40 | 40 |
| 41 // Initializes the object to point to a given file. The file must aready exist | 41 // Initializes the object to point to a given file. The file must aready exist |
| 42 // on disk, and allow shared read and write. | 42 // on disk, and allow shared read and write. |
| 43 bool Init(const FilePath& name); | 43 bool Init(const FilePath& name); |
| 44 | 44 |
| (...skipping 35 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 |