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

Side by Side Diff: content/browser/appcache/appcache_response.h

Issue 1315443003: ServiceWorkerWriteToCacheJob: refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last nits for falken Created 5 years, 3 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache_writer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ 6 #define CONTENT_BROWSER_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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 : public AppCacheResponseIO { 201 : public AppCacheResponseIO {
202 public: 202 public:
203 ~AppCacheResponseWriter() override; 203 ~AppCacheResponseWriter() override;
204 204
205 // Writes the http info to storage. Always returns the result of the write 205 // Writes the http info to storage. Always returns the result of the write
206 // asynchronously through the 'callback'. Returns the number of bytes written 206 // asynchronously through the 'callback'. Returns the number of bytes written
207 // or a net:: error code. The writer acquires a reference to the 'info_buf' 207 // or a net:: error code. The writer acquires a reference to the 'info_buf'
208 // until completion at which time the callback is invoked with either a 208 // until completion at which time the callback is invoked with either a
209 // negative error code or the number of bytes written. The 'callback' is a 209 // negative error code or the number of bytes written. The 'callback' is a
210 // required parameter. The contents of 'info_buf' are not modified. 210 // required parameter. The contents of 'info_buf' are not modified.
211 // Should only be called where there is no Write operation in progress. 211 // Should only be called where there is no Write operation in progress.
michaeln 2015/09/10 20:50:27 please put a comment here that says // (virtual fo
212 void WriteInfo(HttpResponseInfoIOBuffer* info_buf, 212 virtual void WriteInfo(HttpResponseInfoIOBuffer* info_buf,
213 const net::CompletionCallback& callback); 213 const net::CompletionCallback& callback);
214 214
215 // Writes data to storage. Always returns the result of the write 215 // Writes data to storage. Always returns the result of the write
216 // asynchronously through the 'callback'. Returns the number of bytes written 216 // asynchronously through the 'callback'. Returns the number of bytes written
217 // or a net:: error code. Guaranteed to not perform partial writes. 217 // or a net:: error code. Guaranteed to not perform partial writes.
218 // The writer acquires a reference to the provided 'buf' until completion at 218 // The writer acquires a reference to the provided 'buf' until completion at
219 // which time the callback is invoked with either a negative error code or 219 // which time the callback is invoked with either a negative error code or
220 // the number of bytes written. The 'callback' is a required parameter. 220 // the number of bytes written. The 'callback' is a required parameter.
221 // The contents of 'buf' are not modified. 221 // The contents of 'buf' are not modified.
222 // Should only be called where there is no Write operation in progress. 222 // Should only be called where there is no Write operation in progress.
223 void WriteData(net::IOBuffer* buf, int buf_len, 223 virtual void WriteData(net::IOBuffer* buf,
224 const net::CompletionCallback& callback); 224 int buf_len,
225 const net::CompletionCallback& callback);
225 226
226 // Returns true if there is a write pending. 227 // Returns true if there is a write pending.
227 bool IsWritePending() { return IsIOPending(); } 228 bool IsWritePending() { return IsIOPending(); }
228 229
229 // Returns the amount written, info and data. 230 // Returns the amount written, info and data.
230 int64 amount_written() { return info_size_ + write_position_; } 231 int64 amount_written() { return info_size_ + write_position_; }
231 232
232 protected: 233 protected:
233 // Should only be constructed by the storage class and derivatives. 234 // Should only be constructed by the storage class and derivatives.
234 AppCacheResponseWriter(int64 response_id, 235 AppCacheResponseWriter(int64 response_id,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 void OnIOComplete(int result) override; 298 void OnIOComplete(int result) override;
298 void OnOpenEntryComplete() override; 299 void OnOpenEntryComplete() override;
299 300
300 int write_amount_; 301 int write_amount_;
301 base::WeakPtrFactory<AppCacheResponseMetadataWriter> weak_factory_; 302 base::WeakPtrFactory<AppCacheResponseMetadataWriter> weak_factory_;
302 }; 303 };
303 304
304 } // namespace content 305 } // namespace content
305 306
306 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_ 307 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_RESPONSE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698