| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101                             const FilePath& cache_directory, | 101                             const FilePath& cache_directory, | 
| 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, NULL, | 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   if (rv == net::ERR_IO_PENDING) | 113   if (rv == net::ERR_IO_PENDING) | 
| 114     init_callback_ = callback; | 114     init_callback_ = callback; | 
| 115   else | 115   else | 
| 116     OnCreateBackendComplete(rv); | 116     OnCreateBackendComplete(rv); | 
| 117   return rv; | 117   return rv; | 
| 118 } | 118 } | 
| 119 | 119 | 
| 120 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { | 120 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { | 
| 121   if (rv == net::OK) { | 121   if (rv == net::OK) { | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 149         break; | 149         break; | 
| 150     } | 150     } | 
| 151     if (rv != net::ERR_IO_PENDING) | 151     if (rv != net::ERR_IO_PENDING) | 
| 152       iter->callback->Run(rv); | 152       iter->callback->Run(rv); | 
| 153   } | 153   } | 
| 154   pending_calls_.clear(); | 154   pending_calls_.clear(); | 
| 155 } | 155 } | 
| 156 | 156 | 
| 157 }  // namespace appcache | 157 }  // namespace appcache | 
| 158 | 158 | 
| OLD | NEW | 
|---|