| OLD | NEW |
| 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 "net/url_request/view_cache_helper.h" | 5 #include "net/url_request/view_cache_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
| 7 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 8 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
| 9 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 11 #include "net/disk_cache/disk_cache.h" | 13 #include "net/disk_cache/disk_cache.h" |
| 12 #include "net/http/http_cache.h" | 14 #include "net/http/http_cache.h" |
| 13 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
| 14 #include "net/http/http_response_info.h" | 16 #include "net/http/http_response_info.h" |
| 15 #include "net/url_request/url_request_context.h" | 17 #include "net/url_request/url_request_context.h" |
| 16 | 18 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 next_state_ = STATE_OPEN_NEXT_ENTRY; | 237 next_state_ = STATE_OPEN_NEXT_ENTRY; |
| 236 return OK; | 238 return OK; |
| 237 } | 239 } |
| 238 | 240 |
| 239 next_state_ = STATE_OPEN_ENTRY; | 241 next_state_ = STATE_OPEN_ENTRY; |
| 240 return OK; | 242 return OK; |
| 241 } | 243 } |
| 242 | 244 |
| 243 int ViewCacheHelper::DoOpenNextEntry() { | 245 int ViewCacheHelper::DoOpenNextEntry() { |
| 244 next_state_ = STATE_OPEN_NEXT_ENTRY_COMPLETE; | 246 next_state_ = STATE_OPEN_NEXT_ENTRY_COMPLETE; |
| 245 return disk_cache_->OpenNextEntry(&iter_, &entry_, &cache_callback_); | 247 return disk_cache_->OpenNextEntry( |
| 248 &iter_, &entry_, |
| 249 base::Bind(&ViewCacheHelper::OnIOComplete, base::Unretained(this))); |
| 246 } | 250 } |
| 247 | 251 |
| 248 int ViewCacheHelper::DoOpenNextEntryComplete(int result) { | 252 int ViewCacheHelper::DoOpenNextEntryComplete(int result) { |
| 249 if (result == ERR_FAILED) { | 253 if (result == ERR_FAILED) { |
| 250 data_->append(VIEW_CACHE_TAIL); | 254 data_->append(VIEW_CACHE_TAIL); |
| 251 return OK; | 255 return OK; |
| 252 } | 256 } |
| 253 | 257 |
| 254 DCHECK_EQ(OK, result); | 258 DCHECK_EQ(OK, result); |
| 255 data_->append(FormatEntryInfo(entry_, url_prefix_)); | 259 data_->append(FormatEntryInfo(entry_, url_prefix_)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 entry_ = NULL; | 352 entry_ = NULL; |
| 349 } | 353 } |
| 350 return OK; | 354 return OK; |
| 351 } | 355 } |
| 352 | 356 |
| 353 void ViewCacheHelper::OnIOComplete(int result) { | 357 void ViewCacheHelper::OnIOComplete(int result) { |
| 354 DoLoop(result); | 358 DoLoop(result); |
| 355 } | 359 } |
| 356 | 360 |
| 357 } // namespace net. | 361 } // namespace net. |
| OLD | NEW |