Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 FileIOCallback* callback, bool* completed); | 61 FileIOCallback* callback, bool* completed); |
| 62 | 62 |
| 63 // Sets the file's length. The file is truncated or extended with zeros to | 63 // Sets the file's length. The file is truncated or extended with zeros to |
| 64 // the new length. | 64 // the new length. |
| 65 bool SetLength(size_t length); | 65 bool SetLength(size_t length); |
| 66 size_t GetLength(); | 66 size_t GetLength(); |
| 67 | 67 |
| 68 // Blocks until |num_pending_io| IO operations complete. | 68 // Blocks until |num_pending_io| IO operations complete. |
| 69 static void WaitForPendingIO(int* num_pending_io); | 69 static void WaitForPendingIO(int* num_pending_io); |
| 70 | 70 |
| 71 // Drops current pending operation without waiting for them to complete. | |
|
gavinp
2012/03/20 15:40:08
Nit: // Drops current pending operations without w
| |
| 72 static void DropPendingIO(); | |
| 73 | |
| 71 protected: | 74 protected: |
| 72 virtual ~File(); | 75 virtual ~File(); |
| 73 | 76 |
| 74 // Performs the actual asynchronous write. If notify is set and there is no | 77 // Performs the actual asynchronous write. If notify is set and there is no |
| 75 // callback, the call will be re-synchronized. | 78 // callback, the call will be re-synchronized. |
| 76 bool AsyncWrite(const void* buffer, size_t buffer_len, size_t offset, | 79 bool AsyncWrite(const void* buffer, size_t buffer_len, size_t offset, |
| 77 FileIOCallback* callback, bool* completed); | 80 FileIOCallback* callback, bool* completed); |
| 78 | 81 |
| 79 private: | 82 private: |
| 80 bool init_; | 83 bool init_; |
| 81 bool mixed_; | 84 bool mixed_; |
| 82 base::PlatformFile platform_file_; // Regular, asynchronous IO handle. | 85 base::PlatformFile platform_file_; // Regular, asynchronous IO handle. |
| 83 base::PlatformFile sync_platform_file_; // Synchronous IO handle. | 86 base::PlatformFile sync_platform_file_; // Synchronous IO handle. |
| 84 | 87 |
| 85 DISALLOW_COPY_AND_ASSIGN(File); | 88 DISALLOW_COPY_AND_ASSIGN(File); |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace disk_cache | 91 } // namespace disk_cache |
| 89 | 92 |
| 90 #endif // NET_DISK_CACHE_FILE_H_ | 93 #endif // NET_DISK_CACHE_FILE_H_ |
| OLD | NEW |