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

Side by Side Diff: webkit/appcache/appcache_response.h

Issue 8343018: More groundwork for flat file based response storage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_
6 #define WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 AppCacheDiskCacheInterface::Entry* entry_ptr_; // Accessed directly. 112 AppCacheDiskCacheInterface::Entry* entry_ptr_; // Accessed directly.
113 private: 113 private:
114 ~EntryCallback() { 114 ~EntryCallback() {
115 if (entry_ptr_) 115 if (entry_ptr_)
116 entry_ptr_->Close(); 116 entry_ptr_->Close();
117 } 117 }
118 }; 118 };
119 119
120 AppCacheResponseIO(int64 response_id, 120 AppCacheResponseIO(int64 response_id,
121 int64 group_id,
121 AppCacheDiskCacheInterface* disk_cache); 122 AppCacheDiskCacheInterface* disk_cache);
122 123
123 virtual void OnIOComplete(int result) = 0; 124 virtual void OnIOComplete(int result) = 0;
124 125
125 bool IsIOPending() { return user_callback_ ? true : false; } 126 bool IsIOPending() { return user_callback_ ? true : false; }
126 void ScheduleIOOldCompletionCallback(int result); 127 void ScheduleIOOldCompletionCallback(int result);
127 void InvokeUserOldCompletionCallback(int result); 128 void InvokeUserOldCompletionCallback(int result);
128 void ReadRaw(int index, int offset, net::IOBuffer* buf, int buf_len); 129 void ReadRaw(int index, int offset, net::IOBuffer* buf, int buf_len);
129 void WriteRaw(int index, int offset, net::IOBuffer* buf, int buf_len); 130 void WriteRaw(int index, int offset, net::IOBuffer* buf, int buf_len);
130 131
131 const int64 response_id_; 132 const int64 response_id_;
133 const int64 group_id_;
132 AppCacheDiskCacheInterface* disk_cache_; 134 AppCacheDiskCacheInterface* disk_cache_;
133 AppCacheDiskCacheInterface::Entry* entry_; 135 AppCacheDiskCacheInterface::Entry* entry_;
134 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_; 136 scoped_refptr<HttpResponseInfoIOBuffer> info_buffer_;
135 scoped_refptr<net::IOBuffer> buffer_; 137 scoped_refptr<net::IOBuffer> buffer_;
136 int buffer_len_; 138 int buffer_len_;
137 net::OldCompletionCallback* user_callback_; 139 net::OldCompletionCallback* user_callback_;
138 ScopedRunnableMethodFactory<AppCacheResponseIO> method_factory_; 140 ScopedRunnableMethodFactory<AppCacheResponseIO> method_factory_;
139 141
140 private: 142 private:
141 void OnRawIOComplete(int result); 143 void OnRawIOComplete(int result);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // read the entire response body. If called, this must be called prior 185 // read the entire response body. If called, this must be called prior
184 // to the first call to the ReadData method. 186 // to the first call to the ReadData method.
185 void SetReadRange(int offset, int length); 187 void SetReadRange(int offset, int length);
186 188
187 protected: 189 protected:
188 friend class AppCacheStorageImpl; 190 friend class AppCacheStorageImpl;
189 friend class MockAppCacheStorage; 191 friend class MockAppCacheStorage;
190 192
191 // Should only be constructed by the storage class. 193 // Should only be constructed by the storage class.
192 AppCacheResponseReader(int64 response_id, 194 AppCacheResponseReader(int64 response_id,
195 int64 group_id,
193 AppCacheDiskCacheInterface* disk_cache); 196 AppCacheDiskCacheInterface* disk_cache);
194 197
195 virtual void OnIOComplete(int result); 198 virtual void OnIOComplete(int result);
196 void ContinueReadInfo(); 199 void ContinueReadInfo();
197 void ContinueReadData(); 200 void ContinueReadData();
198 void OpenEntryIfNeededAndContinue(); 201 void OpenEntryIfNeededAndContinue();
199 void OnOpenEntryComplete(int rv); 202 void OnOpenEntryComplete(int rv);
200 203
201 int range_offset_; 204 int range_offset_;
202 int range_length_; 205 int range_length_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 248
246 enum CreationPhase { 249 enum CreationPhase {
247 NO_ATTEMPT, 250 NO_ATTEMPT,
248 INITIAL_ATTEMPT, 251 INITIAL_ATTEMPT,
249 DOOM_EXISTING, 252 DOOM_EXISTING,
250 SECOND_ATTEMPT 253 SECOND_ATTEMPT
251 }; 254 };
252 255
253 // Should only be constructed by the storage class. 256 // Should only be constructed by the storage class.
254 AppCacheResponseWriter(int64 response_id, 257 AppCacheResponseWriter(int64 response_id,
258 int64 group_id,
255 AppCacheDiskCacheInterface* disk_cache); 259 AppCacheDiskCacheInterface* disk_cache);
256 260
257 virtual void OnIOComplete(int result); 261 virtual void OnIOComplete(int result);
258 void ContinueWriteInfo(); 262 void ContinueWriteInfo();
259 void ContinueWriteData(); 263 void ContinueWriteData();
260 void CreateEntryIfNeededAndContinue(); 264 void CreateEntryIfNeededAndContinue();
261 void OnCreateEntryComplete(int rv); 265 void OnCreateEntryComplete(int rv);
262 266
263 int info_size_; 267 int info_size_;
264 int write_position_; 268 int write_position_;
265 int write_amount_; 269 int write_amount_;
266 CreationPhase creation_phase_; 270 CreationPhase creation_phase_;
267 scoped_refptr<EntryCallback<AppCacheResponseWriter> > create_callback_; 271 scoped_refptr<EntryCallback<AppCacheResponseWriter> > create_callback_;
268 }; 272 };
269 273
270 } // namespace appcache 274 } // namespace appcache
271 275
272 #endif // WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_ 276 #endif // WEBKIT_APPCACHE_APPCACHE_RESPONSE_H_
273 277
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_request_handler_unittest.cc ('k') | webkit/appcache/appcache_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698