OLD | NEW |
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 #include "webkit/appcache/appcache_response.h" | 5 #include "webkit/appcache/appcache_response.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // AppCacheResponseIO ---------------------------------------------- | 76 // AppCacheResponseIO ---------------------------------------------- |
77 | 77 |
78 AppCacheResponseIO::AppCacheResponseIO( | 78 AppCacheResponseIO::AppCacheResponseIO( |
79 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) | 79 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) |
80 : response_id_(response_id), | 80 : response_id_(response_id), |
81 group_id_(group_id), | 81 group_id_(group_id), |
82 disk_cache_(disk_cache), | 82 disk_cache_(disk_cache), |
83 entry_(NULL), | 83 entry_(NULL), |
84 buffer_len_(0), | 84 buffer_len_(0), |
85 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 85 weak_factory_(this) { |
86 } | 86 } |
87 | 87 |
88 AppCacheResponseIO::~AppCacheResponseIO() { | 88 AppCacheResponseIO::~AppCacheResponseIO() { |
89 if (entry_) | 89 if (entry_) |
90 entry_->Close(); | 90 entry_->Close(); |
91 } | 91 } |
92 | 92 |
93 void AppCacheResponseIO::ScheduleIOCompletionCallback(int result) { | 93 void AppCacheResponseIO::ScheduleIOCompletionCallback(int result) { |
94 MessageLoop::current()->PostTask( | 94 MessageLoop::current()->PostTask( |
95 FROM_HERE, base::Bind(&AppCacheResponseIO::OnIOComplete, | 95 FROM_HERE, base::Bind(&AppCacheResponseIO::OnIOComplete, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 | 136 |
137 // AppCacheResponseReader ---------------------------------------------- | 137 // AppCacheResponseReader ---------------------------------------------- |
138 | 138 |
139 AppCacheResponseReader::AppCacheResponseReader( | 139 AppCacheResponseReader::AppCacheResponseReader( |
140 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) | 140 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) |
141 : AppCacheResponseIO(response_id, group_id, disk_cache), | 141 : AppCacheResponseIO(response_id, group_id, disk_cache), |
142 range_offset_(0), | 142 range_offset_(0), |
143 range_length_(kint32max), | 143 range_length_(kint32max), |
144 read_position_(0), | 144 read_position_(0), |
145 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 145 weak_factory_(this) { |
146 } | 146 } |
147 | 147 |
148 AppCacheResponseReader::~AppCacheResponseReader() { | 148 AppCacheResponseReader::~AppCacheResponseReader() { |
149 } | 149 } |
150 | 150 |
151 void AppCacheResponseReader::ReadInfo(HttpResponseInfoIOBuffer* info_buf, | 151 void AppCacheResponseReader::ReadInfo(HttpResponseInfoIOBuffer* info_buf, |
152 const net::CompletionCallback& callback) { | 152 const net::CompletionCallback& callback) { |
153 DCHECK(!callback.is_null()); | 153 DCHECK(!callback.is_null()); |
154 DCHECK(!IsReadPending()); | 154 DCHECK(!IsReadPending()); |
155 DCHECK(info_buf); | 155 DCHECK(info_buf); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 // AppCacheResponseWriter ---------------------------------------------- | 280 // AppCacheResponseWriter ---------------------------------------------- |
281 | 281 |
282 AppCacheResponseWriter::AppCacheResponseWriter( | 282 AppCacheResponseWriter::AppCacheResponseWriter( |
283 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) | 283 int64 response_id, int64 group_id, AppCacheDiskCacheInterface* disk_cache) |
284 : AppCacheResponseIO(response_id, group_id, disk_cache), | 284 : AppCacheResponseIO(response_id, group_id, disk_cache), |
285 info_size_(0), | 285 info_size_(0), |
286 write_position_(0), | 286 write_position_(0), |
287 write_amount_(0), | 287 write_amount_(0), |
288 creation_phase_(INITIAL_ATTEMPT), | 288 creation_phase_(INITIAL_ATTEMPT), |
289 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 289 weak_factory_(this) { |
290 } | 290 } |
291 | 291 |
292 AppCacheResponseWriter::~AppCacheResponseWriter() { | 292 AppCacheResponseWriter::~AppCacheResponseWriter() { |
293 } | 293 } |
294 | 294 |
295 void AppCacheResponseWriter::WriteInfo( | 295 void AppCacheResponseWriter::WriteInfo( |
296 HttpResponseInfoIOBuffer* info_buf, | 296 HttpResponseInfoIOBuffer* info_buf, |
297 const net::CompletionCallback& callback) { | 297 const net::CompletionCallback& callback) { |
298 DCHECK(!callback.is_null()); | 298 DCHECK(!callback.is_null()); |
299 DCHECK(!IsWritePending()); | 299 DCHECK(!IsWritePending()); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 create_callback_.Reset(); | 411 create_callback_.Reset(); |
412 } | 412 } |
413 | 413 |
414 if (info_buffer_) | 414 if (info_buffer_) |
415 ContinueWriteInfo(); | 415 ContinueWriteInfo(); |
416 else | 416 else |
417 ContinueWriteData(); | 417 ContinueWriteData(); |
418 } | 418 } |
419 | 419 |
420 } // namespace appcache | 420 } // namespace appcache |
OLD | NEW |