OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "net/disk_cache/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/field_trial.h" | 7 #include "base/field_trial.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // still fail if we are not able to rename the cache folder (for instance due to | 321 // still fail if we are not able to rename the cache folder (for instance due to |
322 // a sharing violation), and in that case a cache for this profile (on the | 322 // a sharing violation), and in that case a cache for this profile (on the |
323 // desired path) cannot be created. | 323 // desired path) cannot be created. |
324 // | 324 // |
325 // Static. | 325 // Static. |
326 int BackendImpl::CreateBackend(const FilePath& full_path, bool force, | 326 int BackendImpl::CreateBackend(const FilePath& full_path, bool force, |
327 int max_bytes, net::CacheType type, | 327 int max_bytes, net::CacheType type, |
328 uint32 flags, base::MessageLoopProxy* thread, | 328 uint32 flags, base::MessageLoopProxy* thread, |
329 Backend** backend, | 329 Backend** backend, |
330 CompletionCallback* callback) { | 330 CompletionCallback* callback) { |
| 331 DCHECK(callback); |
331 CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type, | 332 CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type, |
332 flags, thread, backend, callback); | 333 flags, thread, backend, callback); |
333 // This object will self-destroy when finished. | 334 // This object will self-destroy when finished. |
334 return creator->Run(); | 335 return creator->Run(); |
335 } | 336 } |
336 | 337 |
337 int BackendImpl::Init(CompletionCallback* callback) { | 338 int BackendImpl::Init(CompletionCallback* callback) { |
338 background_queue_.Init(callback); | 339 background_queue_.Init(callback); |
339 return net::ERR_IO_PENDING; | 340 return net::ERR_IO_PENDING; |
340 } | 341 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 timer_.Stop(); | 532 timer_.Stop(); |
532 | 533 |
533 if (init_) { | 534 if (init_) { |
534 if (data_) | 535 if (data_) |
535 data_->header.crash = 0; | 536 data_->header.crash = 0; |
536 | 537 |
537 File::WaitForPendingIO(&num_pending_io_); | 538 File::WaitForPendingIO(&num_pending_io_); |
538 DCHECK(!num_refs_); | 539 DCHECK(!num_refs_); |
539 } | 540 } |
540 factory_.RevokeAll(); | 541 factory_.RevokeAll(); |
| 542 ptr_factory_.InvalidateWeakPtrs(); |
541 done_.Signal(); | 543 done_.Signal(); |
542 } | 544 } |
543 | 545 |
544 // ------------------------------------------------------------------------ | 546 // ------------------------------------------------------------------------ |
545 | 547 |
546 int BackendImpl::OpenPrevEntry(void** iter, Entry** prev_entry, | 548 int BackendImpl::OpenPrevEntry(void** iter, Entry** prev_entry, |
547 CompletionCallback* callback) { | 549 CompletionCallback* callback) { |
548 DCHECK(callback); | 550 DCHECK(callback); |
549 background_queue_.OpenPrevEntry(iter, prev_entry, callback); | 551 background_queue_.OpenPrevEntry(iter, prev_entry, callback); |
550 return net::ERR_IO_PENDING; | 552 return net::ERR_IO_PENDING; |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 | 1860 |
1859 return num_dirty; | 1861 return num_dirty; |
1860 } | 1862 } |
1861 | 1863 |
1862 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { | 1864 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { |
1863 RankingsNode* rankings = cache_entry->rankings()->Data(); | 1865 RankingsNode* rankings = cache_entry->rankings()->Data(); |
1864 return !rankings->dummy; | 1866 return !rankings->dummy; |
1865 } | 1867 } |
1866 | 1868 |
1867 } // namespace disk_cache | 1869 } // namespace disk_cache |
OLD | NEW |