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

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

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
« no previous file with comments | « webkit/appcache/appcache_response.h ('k') | webkit/appcache/appcache_response_unittest.cc » ('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) 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 #include "webkit/appcache/appcache_response.h" 5 #include "webkit/appcache/appcache_response.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 : response_data_size(kUnkownResponseDataSize) {} 65 : response_data_size(kUnkownResponseDataSize) {}
66 66
67 HttpResponseInfoIOBuffer::HttpResponseInfoIOBuffer(net::HttpResponseInfo* info) 67 HttpResponseInfoIOBuffer::HttpResponseInfoIOBuffer(net::HttpResponseInfo* info)
68 : http_info(info), response_data_size(kUnkownResponseDataSize) {} 68 : http_info(info), response_data_size(kUnkownResponseDataSize) {}
69 69
70 HttpResponseInfoIOBuffer::~HttpResponseInfoIOBuffer() {} 70 HttpResponseInfoIOBuffer::~HttpResponseInfoIOBuffer() {}
71 71
72 // AppCacheResponseIO ---------------------------------------------- 72 // AppCacheResponseIO ----------------------------------------------
73 73
74 AppCacheResponseIO::AppCacheResponseIO( 74 AppCacheResponseIO::AppCacheResponseIO(
75 int64 response_id, AppCacheDiskCacheInterface* disk_cache) 75 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache)
76 : response_id_(response_id), disk_cache_(disk_cache), 76 : response_id_(response_id), group_id_(group_id), disk_cache_(disk_cache),
77 entry_(NULL), buffer_len_(0), user_callback_(NULL), 77 entry_(NULL), buffer_len_(0), user_callback_(NULL),
78 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), 78 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
79 ALLOW_THIS_IN_INITIALIZER_LIST(raw_callback_( 79 ALLOW_THIS_IN_INITIALIZER_LIST(raw_callback_(
80 new net::CancelableOldCompletionCallback<AppCacheResponseIO>( 80 new net::CancelableOldCompletionCallback<AppCacheResponseIO>(
81 this, &AppCacheResponseIO::OnRawIOComplete))) { 81 this, &AppCacheResponseIO::OnRawIOComplete))) {
82 } 82 }
83 83
84 AppCacheResponseIO::~AppCacheResponseIO() { 84 AppCacheResponseIO::~AppCacheResponseIO() {
85 raw_callback_->Cancel(); 85 raw_callback_->Cancel();
86 if (entry_) 86 if (entry_)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void AppCacheResponseIO::OnRawIOComplete(int result) { 128 void AppCacheResponseIO::OnRawIOComplete(int result) {
129 DCHECK_NE(net::ERR_IO_PENDING, result); 129 DCHECK_NE(net::ERR_IO_PENDING, result);
130 raw_callback_->Release(); // Balance the AddRefs 130 raw_callback_->Release(); // Balance the AddRefs
131 OnIOComplete(result); 131 OnIOComplete(result);
132 } 132 }
133 133
134 134
135 // AppCacheResponseReader ---------------------------------------------- 135 // AppCacheResponseReader ----------------------------------------------
136 136
137 AppCacheResponseReader::AppCacheResponseReader( 137 AppCacheResponseReader::AppCacheResponseReader(
138 int64 response_id, AppCacheDiskCacheInterface* disk_cache) 138 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache)
139 : AppCacheResponseIO(response_id, disk_cache), 139 : AppCacheResponseIO(response_id, group_id, disk_cache),
140 range_offset_(0), range_length_(kint32max), 140 range_offset_(0), range_length_(kint32max),
141 read_position_(0) { 141 read_position_(0) {
142 } 142 }
143 143
144 AppCacheResponseReader::~AppCacheResponseReader() { 144 AppCacheResponseReader::~AppCacheResponseReader() {
145 if (open_callback_) 145 if (open_callback_)
146 open_callback_.release()->Cancel(); 146 open_callback_.release()->Cancel();
147 } 147 }
148 148
149 void AppCacheResponseReader::ReadInfo(HttpResponseInfoIOBuffer* info_buf, 149 void AppCacheResponseReader::ReadInfo(HttpResponseInfoIOBuffer* info_buf,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 if (info_buffer_) 263 if (info_buffer_)
264 ContinueReadInfo(); 264 ContinueReadInfo();
265 else 265 else
266 ContinueReadData(); 266 ContinueReadData();
267 } 267 }
268 268
269 // AppCacheResponseWriter ---------------------------------------------- 269 // AppCacheResponseWriter ----------------------------------------------
270 270
271 AppCacheResponseWriter::AppCacheResponseWriter( 271 AppCacheResponseWriter::AppCacheResponseWriter(
272 int64 response_id, AppCacheDiskCacheInterface* disk_cache) 272 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache)
273 : AppCacheResponseIO(response_id, disk_cache), 273 : AppCacheResponseIO(response_id, group_id, disk_cache),
274 info_size_(0), write_position_(0), write_amount_(0), 274 info_size_(0), write_position_(0), write_amount_(0),
275 creation_phase_(INITIAL_ATTEMPT) { 275 creation_phase_(INITIAL_ATTEMPT) {
276 } 276 }
277 277
278 AppCacheResponseWriter::~AppCacheResponseWriter() { 278 AppCacheResponseWriter::~AppCacheResponseWriter() {
279 if (create_callback_) 279 if (create_callback_)
280 create_callback_.release()->Cancel(); 280 create_callback_.release()->Cancel();
281 } 281 }
282 282
283 void AppCacheResponseWriter::WriteInfo(HttpResponseInfoIOBuffer* info_buf, 283 void AppCacheResponseWriter::WriteInfo(HttpResponseInfoIOBuffer* info_buf,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 387 }
388 388
389 if (info_buffer_) 389 if (info_buffer_)
390 ContinueWriteInfo(); 390 ContinueWriteInfo();
391 else 391 else
392 ContinueWriteData(); 392 ContinueWriteData();
393 } 393 }
394 394
395 } // namespace appcache 395 } // namespace appcache
396 396
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_response.h ('k') | webkit/appcache/appcache_response_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698