| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_disk_cache.h" | 5 #include "webkit/appcache/appcache_disk_cache.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 int cache_size, bool force, | 102 int cache_size, bool force, |
| 103 base::MessageLoopProxy* cache_thread, | 103 base::MessageLoopProxy* cache_thread, |
| 104 net::CompletionCallback* callback) { | 104 net::CompletionCallback* callback) { |
| 105 DCHECK(!is_initializing() && !disk_cache_.get()); | 105 DCHECK(!is_initializing() && !disk_cache_.get()); |
| 106 is_disabled_ = false; | 106 is_disabled_ = false; |
| 107 create_backend_callback_ = new CreateBackendCallback( | 107 create_backend_callback_ = new CreateBackendCallback( |
| 108 this, &AppCacheDiskCache::OnCreateBackendComplete); | 108 this, &AppCacheDiskCache::OnCreateBackendComplete); |
| 109 | 109 |
| 110 int rv = disk_cache::CreateCacheBackend( | 110 int rv = disk_cache::CreateCacheBackend( |
| 111 cache_type, cache_directory, cache_size, force, cache_thread, | 111 cache_type, cache_directory, cache_size, force, cache_thread, |
| 112 &(create_backend_callback_->backend_ptr_), create_backend_callback_); | 112 &(create_backend_callback_->backend_ptr_), create_backend_callback_, |
| 113 NULL); |
| 113 if (rv == net::ERR_IO_PENDING) | 114 if (rv == net::ERR_IO_PENDING) |
| 114 init_callback_ = callback; | 115 init_callback_ = callback; |
| 115 else | 116 else |
| 116 OnCreateBackendComplete(rv); | 117 OnCreateBackendComplete(rv); |
| 117 return rv; | 118 return rv; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { | 121 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { |
| 121 if (rv == net::OK) { | 122 if (rv == net::OK) { |
| 122 disk_cache_.reset(create_backend_callback_->backend_ptr_); | 123 disk_cache_.reset(create_backend_callback_->backend_ptr_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 149 break; | 150 break; |
| 150 } | 151 } |
| 151 if (rv != net::ERR_IO_PENDING) | 152 if (rv != net::ERR_IO_PENDING) |
| 152 iter->callback->Run(rv); | 153 iter->callback->Run(rv); |
| 153 } | 154 } |
| 154 pending_calls_.clear(); | 155 pending_calls_.clear(); |
| 155 } | 156 } |
| 156 | 157 |
| 157 } // namespace appcache | 158 } // namespace appcache |
| 158 | 159 |
| OLD | NEW |