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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 base::WeakPtr<SimpleIndex> index, | 93 base::WeakPtr<SimpleIndex> index, |
94 const CompletionCallback& completion_callback, | 94 const CompletionCallback& completion_callback, |
95 const std::string& key, | 95 const std::string& key, |
96 Entry** out_entry, | 96 Entry** out_entry, |
97 SimpleSynchronousEntry* sync_entry); | 97 SimpleSynchronousEntry* sync_entry); |
98 | 98 |
99 // Called after a SimpleSynchronousEntry has completed an asynchronous IO | 99 // Called after a SimpleSynchronousEntry has completed an asynchronous IO |
100 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. | 100 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. |
101 // If |entry| no longer exists, then it ensures |sync_entry| is closed. | 101 // If |entry| no longer exists, then it ensures |sync_entry| is closed. |
102 static void EntryOperationComplete( | 102 static void EntryOperationComplete( |
| 103 base::WeakPtr<SimpleIndex> index, |
103 const CompletionCallback& completion_callback, | 104 const CompletionCallback& completion_callback, |
104 base::WeakPtr<SimpleEntryImpl> entry, | 105 base::WeakPtr<SimpleEntryImpl> entry, |
105 SimpleSynchronousEntry* sync_entry, | 106 SimpleSynchronousEntry* sync_entry, |
106 int result); | 107 int result); |
107 | 108 |
108 // Called on construction and also after the completion of asynchronous IO to | 109 // Called on construction and also after the completion of asynchronous IO to |
109 // initialize the IO thread copies of data returned by synchronous accessor | 110 // initialize the IO thread copies of data returned by synchronous accessor |
110 // functions. Copies data from |synchronous_entry_| into |this|, so that | 111 // functions. Copies data from |synchronous_entry_| into |this|, so that |
111 // values can be returned during our next IO operation. | 112 // values can be returned during our next IO operation. |
112 void SetSynchronousData(); | 113 void SetSynchronousData(); |
(...skipping 26 matching lines...) Expand all Loading... |
139 // and false after. Used to ensure thread safety by not allowing multiple | 140 // and false after. Used to ensure thread safety by not allowing multiple |
140 // threads to access the |synchronous_entry_| simultaneously. | 141 // threads to access the |synchronous_entry_| simultaneously. |
141 bool synchronous_entry_in_use_by_worker_; | 142 bool synchronous_entry_in_use_by_worker_; |
142 | 143 |
143 base::WeakPtr<SimpleIndex> index_; | 144 base::WeakPtr<SimpleIndex> index_; |
144 }; | 145 }; |
145 | 146 |
146 } // namespace disk_cache | 147 } // namespace disk_cache |
147 | 148 |
148 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 149 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
OLD | NEW |