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_disk_cache.h" | 5 #include "webkit/appcache/appcache_disk_cache.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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 pending_calls_.push_back(PendingCall(DOOM, key, NULL, callback)); | 236 pending_calls_.push_back(PendingCall(DOOM, key, NULL, callback)); |
237 return net::ERR_IO_PENDING; | 237 return net::ERR_IO_PENDING; |
238 } | 238 } |
239 | 239 |
240 if (!disk_cache_.get()) | 240 if (!disk_cache_.get()) |
241 return net::ERR_FAILED; | 241 return net::ERR_FAILED; |
242 | 242 |
243 return (new ActiveCall(this))->DoomEntry(key, callback); | 243 return (new ActiveCall(this))->DoomEntry(key, callback); |
244 } | 244 } |
245 | 245 |
| 246 AppCacheDiskCache::PendingCall::PendingCall() |
| 247 : call_type(CREATE), |
| 248 key(0), |
| 249 entry(NULL) { |
| 250 } |
| 251 |
| 252 AppCacheDiskCache::PendingCall::PendingCall(PendingCallType call_type, |
| 253 int64 key, |
| 254 Entry** entry, |
| 255 const net::CompletionCallback& callback) |
| 256 : call_type(call_type), |
| 257 key(key), |
| 258 entry(entry), |
| 259 callback(callback) { |
| 260 } |
| 261 |
246 AppCacheDiskCache::PendingCall::~PendingCall() {} | 262 AppCacheDiskCache::PendingCall::~PendingCall() {} |
247 | 263 |
248 int AppCacheDiskCache::Init(net::CacheType cache_type, | 264 int AppCacheDiskCache::Init(net::CacheType cache_type, |
249 const FilePath& cache_directory, | 265 const FilePath& cache_directory, |
250 int cache_size, bool force, | 266 int cache_size, bool force, |
251 base::MessageLoopProxy* cache_thread, | 267 base::MessageLoopProxy* cache_thread, |
252 const net::CompletionCallback& callback) { | 268 const net::CompletionCallback& callback) { |
253 DCHECK(!is_initializing() && !disk_cache_.get()); | 269 DCHECK(!is_initializing() && !disk_cache_.get()); |
254 is_disabled_ = false; | 270 is_disabled_ = false; |
255 create_backend_callback_ = new CreateBackendCallbackShim(this); | 271 create_backend_callback_ = new CreateBackendCallbackShim(this); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 NOTREACHED(); | 313 NOTREACHED(); |
298 break; | 314 break; |
299 } | 315 } |
300 if (rv != net::ERR_IO_PENDING) | 316 if (rv != net::ERR_IO_PENDING) |
301 iter->callback.Run(rv); | 317 iter->callback.Run(rv); |
302 } | 318 } |
303 pending_calls_.clear(); | 319 pending_calls_.clear(); |
304 } | 320 } |
305 | 321 |
306 } // namespace appcache | 322 } // namespace appcache |
307 | |
OLD | NEW |