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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // OpenEntry(). Constructs the new SimpleEntryImpl (if |result| is net::OK) | 82 // OpenEntry(). Constructs the new SimpleEntryImpl (if |result| is net::OK) |
83 // and passes it back to the caller via |out_entry|. Also runs | 83 // and passes it back to the caller via |out_entry|. Also runs |
84 // |completion_callback|. | 84 // |completion_callback|. |
85 static void CreationOperationComplete( | 85 static void CreationOperationComplete( |
86 const CompletionCallback& completion_callback, | 86 const CompletionCallback& completion_callback, |
87 Entry** out_entry, | 87 Entry** out_entry, |
88 SimpleSynchronousEntry* sync_entry); | 88 SimpleSynchronousEntry* sync_entry); |
89 | 89 |
90 // Called after a SimpleSynchronousEntry has completed an asynchronous IO | 90 // Called after a SimpleSynchronousEntry has completed an asynchronous IO |
91 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. | 91 // operation, such as ReadData() or WriteData(). Calls |completion_callback|. |
| 92 // If |entry| no longer exists, then it ensures |sync_entry| is closed. |
92 static void EntryOperationComplete( | 93 static void EntryOperationComplete( |
93 const CompletionCallback& completion_callback, | 94 const CompletionCallback& completion_callback, |
94 base::WeakPtr<SimpleEntryImpl> entry, | 95 base::WeakPtr<SimpleEntryImpl> entry, |
| 96 SimpleSynchronousEntry* sync_entry, |
95 int result); | 97 int result); |
96 | 98 |
97 // Called on construction and also after the completion of asynchronous IO to | 99 // Called on construction and also after the completion of asynchronous IO to |
98 // initialize the IO thread copies of data returned by synchronous accessor | 100 // initialize the IO thread copies of data returned by synchronous accessor |
99 // functions. Copies data from |synchronous_entry_| into |this|, so that | 101 // functions. Copies data from |synchronous_entry_| into |this|, so that |
100 // values can be returned during our next IO operation. | 102 // values can be returned during our next IO operation. |
101 void SetSynchronousData(); | 103 void SetSynchronousData(); |
102 | 104 |
103 base::WeakPtrFactory<SimpleEntryImpl> weak_ptr_factory_; | 105 base::WeakPtrFactory<SimpleEntryImpl> weak_ptr_factory_; |
104 | 106 |
(...skipping 14 matching lines...) Expand all Loading... |
119 | 121 |
120 // Set to true when a worker operation is posted on the |synchronous_entry_|, | 122 // Set to true when a worker operation is posted on the |synchronous_entry_|, |
121 // and false after. Used to insure thread safety by not allowing multiple | 123 // and false after. Used to insure thread safety by not allowing multiple |
122 // threads to access the |synchronous_entry_| simultaneously. | 124 // threads to access the |synchronous_entry_| simultaneously. |
123 bool synchronous_entry_in_use_by_worker_; | 125 bool synchronous_entry_in_use_by_worker_; |
124 }; | 126 }; |
125 | 127 |
126 } // namespace disk_cache | 128 } // namespace disk_cache |
127 | 129 |
128 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 130 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
OLD | NEW |