| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/files/file_enumerator.h" | 18 #include "base/files/file_enumerator.h" |
| 19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 20 #include "base/metrics/histogram_macros.h" | 20 #include "base/metrics/histogram_macros.h" |
| 21 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
| 22 #include "base/sequenced_task_runner.h" | 22 #include "base/sequenced_task_runner.h" |
| 23 #include "base/single_thread_task_runner.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/time/time.h" | 26 #include "base/time/time.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 27 #include "components/favicon_base/select_favicon_frames.h" | 28 #include "components/favicon_base/select_favicon_frames.h" |
| 28 #include "components/history/core/browser/download_constants.h" | 29 #include "components/history/core/browser/download_constants.h" |
| 29 #include "components/history/core/browser/download_row.h" | 30 #include "components/history/core/browser/download_row.h" |
| 30 #include "components/history/core/browser/history_backend_client.h" | 31 #include "components/history/core/browser/history_backend_client.h" |
| 31 #include "components/history/core/browser/history_backend_observer.h" | 32 #include "components/history/core/browser/history_backend_observer.h" |
| 32 #include "components/history/core/browser/history_constants.h" | 33 #include "components/history/core/browser/history_constants.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 221 |
| 221 // Release stashed embedder object before cleaning up the databases. | 222 // Release stashed embedder object before cleaning up the databases. |
| 222 supports_user_data_helper_.reset(); | 223 supports_user_data_helper_.reset(); |
| 223 | 224 |
| 224 // First close the databases before optionally running the "destroy" task. | 225 // First close the databases before optionally running the "destroy" task. |
| 225 CloseAllDatabases(); | 226 CloseAllDatabases(); |
| 226 | 227 |
| 227 if (!backend_destroy_task_.is_null()) { | 228 if (!backend_destroy_task_.is_null()) { |
| 228 // Notify an interested party (typically a unit test) that we're done. | 229 // Notify an interested party (typically a unit test) that we're done. |
| 229 DCHECK(backend_destroy_message_loop_); | 230 DCHECK(backend_destroy_message_loop_); |
| 230 backend_destroy_message_loop_->PostTask(FROM_HERE, backend_destroy_task_); | 231 backend_destroy_message_loop_->task_runner()->PostTask( |
| 232 FROM_HERE, backend_destroy_task_); |
| 231 } | 233 } |
| 232 | 234 |
| 233 #if defined(OS_ANDROID) | 235 #if defined(OS_ANDROID) |
| 234 if (backend_client_ && !history_dir_.empty()) | 236 if (backend_client_ && !history_dir_.empty()) |
| 235 backend_client_->OnHistoryBackendDestroyed(this, history_dir_); | 237 backend_client_->OnHistoryBackendDestroyed(this, history_dir_); |
| 236 #endif | 238 #endif |
| 237 } | 239 } |
| 238 | 240 |
| 239 void HistoryBackend::Init( | 241 void HistoryBackend::Init( |
| 240 bool force_fail, | 242 bool force_fail, |
| (...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 // transaction is currently open. | 2624 // transaction is currently open. |
| 2623 db_->CommitTransaction(); | 2625 db_->CommitTransaction(); |
| 2624 db_->Vacuum(); | 2626 db_->Vacuum(); |
| 2625 db_->BeginTransaction(); | 2627 db_->BeginTransaction(); |
| 2626 db_->GetStartDate(&first_recorded_time_); | 2628 db_->GetStartDate(&first_recorded_time_); |
| 2627 | 2629 |
| 2628 return true; | 2630 return true; |
| 2629 } | 2631 } |
| 2630 | 2632 |
| 2631 } // namespace history | 2633 } // namespace history |
| OLD | NEW |