Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(691)

Side by Side Diff: net/disk_cache/simple/simple_entry_impl.h

Issue 12277004: Make SimpleEntryImpl::Close asynchronous. (Closed) Base URL: http://git.chromium.org/git/chromium.git@3-doomdoom
Patch Set: remediate Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_entry_impl.cc » ('j') | net/disk_cache/simple/simple_entry_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698