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 "components/history/core/browser/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 scheduled_kill_db_(false), | 210 scheduled_kill_db_(false), |
211 expirer_(this, backend_client.get(), task_runner), | 211 expirer_(this, backend_client.get(), task_runner), |
212 recent_redirects_(kMaxRedirectCount), | 212 recent_redirects_(kMaxRedirectCount), |
213 backend_destroy_message_loop_(nullptr), | 213 backend_destroy_message_loop_(nullptr), |
214 segment_queried_(false), | 214 segment_queried_(false), |
215 backend_client_(std::move(backend_client)), | 215 backend_client_(std::move(backend_client)), |
216 task_runner_(task_runner) {} | 216 task_runner_(task_runner) {} |
217 | 217 |
218 HistoryBackend::~HistoryBackend() { | 218 HistoryBackend::~HistoryBackend() { |
219 DCHECK(!scheduled_commit_) << "Deleting without cleanup"; | 219 DCHECK(!scheduled_commit_) << "Deleting without cleanup"; |
220 STLDeleteContainerPointers(queued_history_db_tasks_.begin(), | 220 base::STLDeleteContainerPointers(queued_history_db_tasks_.begin(), |
221 queued_history_db_tasks_.end()); | 221 queued_history_db_tasks_.end()); |
222 queued_history_db_tasks_.clear(); | 222 queued_history_db_tasks_.clear(); |
223 | 223 |
224 // Release stashed embedder object before cleaning up the databases. | 224 // Release stashed embedder object before cleaning up the databases. |
225 supports_user_data_helper_.reset(); | 225 supports_user_data_helper_.reset(); |
226 | 226 |
227 // First close the databases before optionally running the "destroy" task. | 227 // First close the databases before optionally running the "destroy" task. |
228 CloseAllDatabases(); | 228 CloseAllDatabases(); |
229 | 229 |
230 if (!backend_destroy_task_.is_null()) { | 230 if (!backend_destroy_task_.is_null()) { |
231 // Notify an interested party (typically a unit test) that we're done. | 231 // Notify an interested party (typically a unit test) that we're done. |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 void HistoryBackend::CancelScheduledCommit() { | 2236 void HistoryBackend::CancelScheduledCommit() { |
2237 if (scheduled_commit_) { | 2237 if (scheduled_commit_) { |
2238 scheduled_commit_->Cancel(); | 2238 scheduled_commit_->Cancel(); |
2239 scheduled_commit_ = nullptr; | 2239 scheduled_commit_ = nullptr; |
2240 } | 2240 } |
2241 } | 2241 } |
2242 | 2242 |
2243 void HistoryBackend::ProcessDBTaskImpl() { | 2243 void HistoryBackend::ProcessDBTaskImpl() { |
2244 if (!db_) { | 2244 if (!db_) { |
2245 // db went away, release all the refs. | 2245 // db went away, release all the refs. |
2246 STLDeleteContainerPointers(queued_history_db_tasks_.begin(), | 2246 base::STLDeleteContainerPointers(queued_history_db_tasks_.begin(), |
2247 queued_history_db_tasks_.end()); | 2247 queued_history_db_tasks_.end()); |
2248 queued_history_db_tasks_.clear(); | 2248 queued_history_db_tasks_.clear(); |
2249 return; | 2249 return; |
2250 } | 2250 } |
2251 | 2251 |
2252 // Remove any canceled tasks. | 2252 // Remove any canceled tasks. |
2253 while (!queued_history_db_tasks_.empty()) { | 2253 while (!queued_history_db_tasks_.empty()) { |
2254 QueuedHistoryDBTask* task = queued_history_db_tasks_.front(); | 2254 QueuedHistoryDBTask* task = queued_history_db_tasks_.front(); |
2255 if (!task->is_canceled()) | 2255 if (!task->is_canceled()) |
2256 break; | 2256 break; |
2257 | 2257 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2629 // transaction is currently open. | 2629 // transaction is currently open. |
2630 db_->CommitTransaction(); | 2630 db_->CommitTransaction(); |
2631 db_->Vacuum(); | 2631 db_->Vacuum(); |
2632 db_->BeginTransaction(); | 2632 db_->BeginTransaction(); |
2633 db_->GetStartDate(&first_recorded_time_); | 2633 db_->GetStartDate(&first_recorded_time_); |
2634 | 2634 |
2635 return true; | 2635 return true; |
2636 } | 2636 } |
2637 | 2637 |
2638 } // namespace history | 2638 } // namespace history |
OLD | NEW |