OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LOCK_H__ | 7 #ifndef NET_DISK_CACHE_FILE_LOCK_H__ |
8 #define NET_DISK_CACHE_FILE_LOCK_H__ | 8 #define NET_DISK_CACHE_FILE_LOCK_H__ |
9 | 9 |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 #include "net/disk_cache/disk_format.h" | 11 #include "net/disk_cache/disk_format_base.h" |
12 | 12 |
13 namespace disk_cache { | 13 namespace disk_cache { |
14 | 14 |
15 // This class implements a file lock that lives on the header of a memory mapped | 15 // This class implements a file lock that lives on the header of a memory mapped |
16 // file. This is NOT a thread related lock, it is a lock to detect corruption | 16 // file. This is NOT a thread related lock, it is a lock to detect corruption |
17 // of the file when the process crashes in the middle of an update. | 17 // of the file when the process crashes in the middle of an update. |
18 // The lock is acquired on the constructor and released on the destructor. | 18 // The lock is acquired on the constructor and released on the destructor. |
19 // The typical use of the class is: | 19 // The typical use of the class is: |
20 // { | 20 // { |
21 // BlockFileHeader* header = GetFileHeader(); | 21 // BlockFileHeader* header = GetFileHeader(); |
(...skipping 14 matching lines...) Expand all Loading... |
36 virtual void Lock(); | 36 virtual void Lock(); |
37 virtual void Unlock(); | 37 virtual void Unlock(); |
38 private: | 38 private: |
39 bool acquired_; | 39 bool acquired_; |
40 volatile int32* updating_; | 40 volatile int32* updating_; |
41 }; | 41 }; |
42 | 42 |
43 } // namespace disk_cache | 43 } // namespace disk_cache |
44 | 44 |
45 #endif // NET_DISK_CACHE_FILE_LOCK_H__ | 45 #endif // NET_DISK_CACHE_FILE_LOCK_H__ |
OLD | NEW |