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_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 base::WeakPtr<SimpleIndex> index, | 92 base::WeakPtr<SimpleIndex> index, |
93 const CompletionCallback& completion_callback, | 93 const CompletionCallback& completion_callback, |
94 const std::string& key, | 94 const std::string& key, |
95 Entry** out_entry, | 95 Entry** out_entry, |
96 SimpleSynchronousEntry* sync_entry); | 96 SimpleSynchronousEntry* sync_entry); |
97 | 97 |
98 // Called after a SimpleSynchronousEntry has completed an asynchronous IO | 98 // Called after a SimpleSynchronousEntry has completed an asynchronous IO |
99 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. | 99 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. |
100 // If |entry| no longer exists, then it ensures |sync_entry| is closed. | 100 // If |entry| no longer exists, then it ensures |sync_entry| is closed. |
101 static void EntryOperationComplete( | 101 static void EntryOperationComplete( |
102 base::WeakPtr<SimpleIndex> index, | |
gavinp
2013/04/10 10:33:23
What's the right thing to do when an operation fin
felipeg
2013/04/10 11:45:35
We do nothing, the index will be stale on disk.
Wh
| |
102 const CompletionCallback& completion_callback, | 103 const CompletionCallback& completion_callback, |
103 base::WeakPtr<SimpleEntryImpl> entry, | 104 base::WeakPtr<SimpleEntryImpl> entry, |
104 SimpleSynchronousEntry* sync_entry, | 105 SimpleSynchronousEntry* sync_entry, |
105 int result); | 106 int result); |
106 | 107 |
107 // Called on construction and also after the completion of asynchronous IO to | 108 // Called on construction and also after the completion of asynchronous IO to |
108 // initialize the IO thread copies of data returned by synchronous accessor | 109 // initialize the IO thread copies of data returned by synchronous accessor |
109 // functions. Copies data from |synchronous_entry_| into |this|, so that | 110 // functions. Copies data from |synchronous_entry_| into |this|, so that |
110 // values can be returned during our next IO operation. | 111 // values can be returned during our next IO operation. |
111 void SetSynchronousData(); | 112 void SetSynchronousData(); |
(...skipping 22 matching lines...) Expand all Loading... | |
134 // and false after. Used to ensure thread safety by not allowing multiple | 135 // and false after. Used to ensure thread safety by not allowing multiple |
135 // threads to access the |synchronous_entry_| simultaneously. | 136 // threads to access the |synchronous_entry_| simultaneously. |
136 bool synchronous_entry_in_use_by_worker_; | 137 bool synchronous_entry_in_use_by_worker_; |
137 | 138 |
138 base::WeakPtr<SimpleIndex> index_; | 139 base::WeakPtr<SimpleIndex> index_; |
139 }; | 140 }; |
140 | 141 |
141 } // namespace disk_cache | 142 } // namespace disk_cache |
142 | 143 |
143 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 144 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
OLD | NEW |