OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Worker thread interface to the very simple cache. This interface is not | 29 // Worker thread interface to the very simple cache. This interface is not |
30 // thread safe, and callers must ensure that it is only ever accessed from | 30 // thread safe, and callers must ensure that it is only ever accessed from |
31 // a single thread between synchronization points. | 31 // a single thread between synchronization points. |
32 class SimpleSynchronousEntry { | 32 class SimpleSynchronousEntry { |
33 public: | 33 public: |
34 // Callback type for the completion of creation of SimpleSynchronousEntry | 34 // Callback type for the completion of creation of SimpleSynchronousEntry |
35 // objects, for instance after OpenEntry() or CreateEntry(). |new_entry| is | 35 // objects, for instance after OpenEntry() or CreateEntry(). |new_entry| is |
36 // the newly created SimpleSynchronousEntry, constructed on the worker pool | 36 // the newly created SimpleSynchronousEntry, constructed on the worker pool |
37 // thread. |new_entry| == NULL in the case of error. | 37 // thread. |new_entry| == NULL in the case of error. |
38 typedef base::Callback<void(SimpleSynchronousEntry* /* new_entry */)> | 38 typedef base::Callback<void(SimpleSynchronousEntry* new_entry)> |
39 SynchronousCreationCallback; | 39 SynchronousCreationCallback; |
40 | 40 |
41 // Callback type for IO operations on an entry not requiring special callback | 41 // Callback type for IO operations on an entry not requiring special callback |
42 // arguments (e.g. Write). |result| is a net::Error result code. | 42 // arguments (e.g. Write). |result| is a net::Error result code. |
43 typedef base::Callback<void(int /* result */)> SynchronousOperationCallback; | 43 typedef base::Callback<void(int result)> SynchronousOperationCallback; |
44 | 44 |
45 static void OpenEntry( | 45 static void OpenEntry( |
46 const base::FilePath& path, | 46 const base::FilePath& path, |
47 const std::string& key, | 47 const std::string& key, |
48 const scoped_refptr<base::TaskRunner>& callback_runner, | 48 const scoped_refptr<base::TaskRunner>& callback_runner, |
49 const SynchronousCreationCallback& callback); | 49 const SynchronousCreationCallback& callback); |
50 | 50 |
51 static void CreateEntry( | 51 static void CreateEntry( |
52 const base::FilePath& path, | 52 const base::FilePath& path, |
53 const std::string& key, | 53 const std::string& key, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 base::Time last_used_; | 106 base::Time last_used_; |
107 base::Time last_modified_; | 107 base::Time last_modified_; |
108 int32 data_size_[kSimpleEntryFileCount]; | 108 int32 data_size_[kSimpleEntryFileCount]; |
109 | 109 |
110 base::PlatformFile files_[kSimpleEntryFileCount]; | 110 base::PlatformFile files_[kSimpleEntryFileCount]; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace disk_cache | 113 } // namespace disk_cache |
114 | 114 |
115 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ | 115 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_SYNCHRONOUS_ENTRY_H_ |
OLD | NEW |