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/browser/appcache/appcache_storage_impl.h" | 5 #include "webkit/browser/appcache/appcache_storage_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1796 cache_thread_ = NULL; | 1796 cache_thread_ = NULL; |
1797 | 1797 |
1798 if (rv != net::ERR_IO_PENDING) | 1798 if (rv != net::ERR_IO_PENDING) |
1799 OnDiskCacheInitialized(rv); | 1799 OnDiskCacheInitialized(rv); |
1800 } | 1800 } |
1801 return disk_cache_.get(); | 1801 return disk_cache_.get(); |
1802 } | 1802 } |
1803 | 1803 |
1804 void AppCacheStorageImpl::OnDiskCacheInitialized(int rv) { | 1804 void AppCacheStorageImpl::OnDiskCacheInitialized(int rv) { |
1805 if (rv != net::OK) { | 1805 if (rv != net::OK) { |
1806 LOG(ERROR) << "Failed to open the appcache diskcache."; | 1806 VLOG(1) << "Failed to open the appcache diskcache."; |
1807 AppCacheHistograms::CountInitResult(AppCacheHistograms::DISK_CACHE_ERROR); | 1807 AppCacheHistograms::CountInitResult(AppCacheHistograms::DISK_CACHE_ERROR); |
1808 | 1808 |
1809 // We're unable to open the disk cache, this is a fatal error that we can't | 1809 // We're unable to open the disk cache, this is a fatal error that we can't |
1810 // really recover from. We handle it by temporarily disabling the appcache | 1810 // really recover from. We handle it by temporarily disabling the appcache |
1811 // deleting the directory on disk and reinitializing the appcache system. | 1811 // deleting the directory on disk and reinitializing the appcache system. |
1812 Disable(); | 1812 Disable(); |
1813 if (!is_incognito_ && rv != net::ERR_ABORTED) { | 1813 if (!is_incognito_ && rv != net::ERR_ABORTED) { |
1814 VLOG(1) << "Deleting existing appcache data and starting over."; | 1814 VLOG(1) << "Deleting existing appcache data and starting over."; |
1815 db_thread_->PostTaskAndReply( | 1815 db_thread_->PostTaskAndReply( |
1816 FROM_HERE, | 1816 FROM_HERE, |
1817 base::Bind(base::IgnoreResult(&base::DeleteFile), | 1817 base::Bind(base::IgnoreResult(&base::DeleteFile), |
1818 cache_directory_, true), | 1818 cache_directory_, true), |
1819 base::Bind(&AppCacheStorageImpl::CallReinitialize, | 1819 base::Bind(&AppCacheStorageImpl::CallReinitialize, |
1820 weak_factory_.GetWeakPtr())); | 1820 weak_factory_.GetWeakPtr())); |
1821 } | 1821 } |
1822 } | 1822 } |
1823 } | 1823 } |
1824 | 1824 |
1825 void AppCacheStorageImpl::CallReinitialize() { | 1825 void AppCacheStorageImpl::CallReinitialize() { |
1826 service_->Reinitialize(); | 1826 service_->Reinitialize(); |
1827 // note: 'this' may be deleted during reinit. | 1827 // note: 'this' may be deleted during reinit. |
1828 } | 1828 } |
1829 | 1829 |
1830 } // namespace appcache | 1830 } // namespace appcache |
OLD | NEW |