| 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_storage_impl.h" | 5 #include "webkit/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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 AppCacheStorageImpl::~AppCacheStorageImpl() { | 1216 AppCacheStorageImpl::~AppCacheStorageImpl() { |
| 1217 std::for_each(pending_quota_queries_.begin(), | 1217 std::for_each(pending_quota_queries_.begin(), |
| 1218 pending_quota_queries_.end(), | 1218 pending_quota_queries_.end(), |
| 1219 std::mem_fun(&DatabaseTask::CancelCompletion)); | 1219 std::mem_fun(&DatabaseTask::CancelCompletion)); |
| 1220 std::for_each(scheduled_database_tasks_.begin(), | 1220 std::for_each(scheduled_database_tasks_.begin(), |
| 1221 scheduled_database_tasks_.end(), | 1221 scheduled_database_tasks_.end(), |
| 1222 std::mem_fun(&DatabaseTask::CancelCompletion)); | 1222 std::mem_fun(&DatabaseTask::CancelCompletion)); |
| 1223 | 1223 |
| 1224 if (database_) { | 1224 if (database_ && |
| 1225 db_thread_->PostTask( | 1225 !db_thread_->PostTask( |
| 1226 FROM_HERE, | 1226 FROM_HERE, |
| 1227 base::Bind(&CleanUpOnDatabaseThread, database_, | 1227 base::Bind(&CleanUpOnDatabaseThread, database_, |
| 1228 make_scoped_refptr(service_->special_storage_policy()), | 1228 make_scoped_refptr(service_->special_storage_policy()), |
| 1229 service()->clear_local_state_on_exit(), | 1229 service()->clear_local_state_on_exit(), |
| 1230 service()->save_session_state())); | 1230 service()->save_session_state()))) { |
| 1231 delete database_; |
| 1231 } | 1232 } |
| 1232 } | 1233 } |
| 1233 | 1234 |
| 1234 void AppCacheStorageImpl::Initialize(const FilePath& cache_directory, | 1235 void AppCacheStorageImpl::Initialize(const FilePath& cache_directory, |
| 1235 base::MessageLoopProxy* db_thread, | 1236 base::MessageLoopProxy* db_thread, |
| 1236 base::MessageLoopProxy* cache_thread) { | 1237 base::MessageLoopProxy* cache_thread) { |
| 1237 DCHECK(db_thread); | 1238 DCHECK(db_thread); |
| 1238 | 1239 |
| 1239 cache_directory_ = cache_directory; | 1240 cache_directory_ = cache_directory; |
| 1240 is_incognito_ = cache_directory_.empty(); | 1241 is_incognito_ = cache_directory_.empty(); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 Disable(); | 1716 Disable(); |
| 1716 if (!is_incognito_) { | 1717 if (!is_incognito_) { |
| 1717 VLOG(1) << "Deleting existing appcache data and starting over."; | 1718 VLOG(1) << "Deleting existing appcache data and starting over."; |
| 1718 db_thread_->PostTask( | 1719 db_thread_->PostTask( |
| 1719 FROM_HERE, base::Bind(&DeleteDirectory, cache_directory_)); | 1720 FROM_HERE, base::Bind(&DeleteDirectory, cache_directory_)); |
| 1720 } | 1721 } |
| 1721 } | 1722 } |
| 1722 } | 1723 } |
| 1723 | 1724 |
| 1724 } // namespace appcache | 1725 } // namespace appcache |
| OLD | NEW |