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_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 int AppCacheDiskCache::Init(net::CacheType cache_type, | 99 int AppCacheDiskCache::Init(net::CacheType cache_type, |
100 const FilePath& cache_directory, | 100 const FilePath& cache_directory, |
101 int cache_size, bool force, | 101 int cache_size, bool force, |
102 net::CompletionCallback* callback) { | 102 net::CompletionCallback* callback) { |
103 DCHECK(!is_initializing() && !disk_cache_.get()); | 103 DCHECK(!is_initializing() && !disk_cache_.get()); |
104 is_disabled_ = false; | 104 is_disabled_ = false; |
105 create_backend_callback_ = new CreateBackendCallback( | 105 create_backend_callback_ = new CreateBackendCallback( |
106 this, &AppCacheDiskCache::OnCreateBackendComplete); | 106 this, &AppCacheDiskCache::OnCreateBackendComplete); |
| 107 |
| 108 // TODO(michaeln): Pass a valid cache_thread here. |
107 int rv = disk_cache::CreateCacheBackend( | 109 int rv = disk_cache::CreateCacheBackend( |
108 cache_type, cache_directory, cache_size, force, | 110 cache_type, cache_directory, cache_size, force, NULL, |
109 &(create_backend_callback_->backend_ptr_), create_backend_callback_); | 111 &(create_backend_callback_->backend_ptr_), create_backend_callback_); |
110 if (rv == net::ERR_IO_PENDING) | 112 if (rv == net::ERR_IO_PENDING) |
111 init_callback_ = callback; | 113 init_callback_ = callback; |
112 else | 114 else |
113 OnCreateBackendComplete(rv); | 115 OnCreateBackendComplete(rv); |
114 return rv; | 116 return rv; |
115 } | 117 } |
116 | 118 |
117 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { | 119 void AppCacheDiskCache::OnCreateBackendComplete(int rv) { |
118 if (rv == net::OK) { | 120 if (rv == net::OK) { |
(...skipping 27 matching lines...) Expand all Loading... |
146 break; | 148 break; |
147 } | 149 } |
148 if (rv != net::ERR_IO_PENDING) | 150 if (rv != net::ERR_IO_PENDING) |
149 iter->callback->Run(rv); | 151 iter->callback->Run(rv); |
150 } | 152 } |
151 pending_calls_.clear(); | 153 pending_calls_.clear(); |
152 } | 154 } |
153 | 155 |
154 } // namespace appcache | 156 } // namespace appcache |
155 | 157 |
OLD | NEW |