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/expire_history_backend.h" | 5 #include "components/history/core/browser/expire_history_backend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
17 #include "base/files/scoped_temp_dir.h" | 17 #include "base/files/scoped_temp_dir.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 20 #include "base/run_loop.h" |
20 #include "base/scoped_observer.h" | 21 #include "base/scoped_observer.h" |
21 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
23 #include "components/history/core/browser/history_backend_client.h" | 24 #include "components/history/core/browser/history_backend_client.h" |
24 #include "components/history/core/browser/history_backend_notifier.h" | 25 #include "components/history/core/browser/history_backend_notifier.h" |
25 #include "components/history/core/browser/history_constants.h" | 26 #include "components/history/core/browser/history_constants.h" |
26 #include "components/history/core/browser/history_database.h" | 27 #include "components/history/core/browser/history_database.h" |
27 #include "components/history/core/browser/thumbnail_database.h" | 28 #include "components/history/core/browser/thumbnail_database.h" |
28 #include "components/history/core/browser/top_sites.h" | 29 #include "components/history/core/browser/top_sites.h" |
29 #include "components/history/core/browser/top_sites_impl.h" | 30 #include "components/history/core/browser/top_sites_impl.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 expirer_.SetDatabases(nullptr, nullptr); | 150 expirer_.SetDatabases(nullptr, nullptr); |
150 | 151 |
151 main_db_.reset(); | 152 main_db_.reset(); |
152 thumb_db_.reset(); | 153 thumb_db_.reset(); |
153 | 154 |
154 top_sites_->ShutdownOnUIThread(); | 155 top_sites_->ShutdownOnUIThread(); |
155 top_sites_ = nullptr; | 156 top_sites_ = nullptr; |
156 | 157 |
157 if (base::MessageLoop::current()) | 158 if (base::MessageLoop::current()) |
158 base::MessageLoop::current()->RunUntilIdle(); | 159 base::RunLoop().RunUntilIdle(); |
159 | 160 |
160 pref_service_.reset(); | 161 pref_service_.reset(); |
161 } | 162 } |
162 | 163 |
163 // HistoryBackendNotifier: | 164 // HistoryBackendNotifier: |
164 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 165 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
165 const GURL& icon_url) override {} | 166 const GURL& icon_url) override {} |
166 void NotifyURLVisited(ui::PageTransition transition, | 167 void NotifyURLVisited(ui::PageTransition transition, |
167 const URLRow& row, | 168 const URLRow& row, |
168 const RedirectList& redirects, | 169 const RedirectList& redirects, |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); | 889 EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1)); |
889 EXPECT_EQ(1U, visits.size()); | 890 EXPECT_EQ(1U, visits.size()); |
890 } | 891 } |
891 | 892 |
892 // TODO(brettw) add some visits with no URL to make sure everything is updated | 893 // TODO(brettw) add some visits with no URL to make sure everything is updated |
893 // properly. Have the visits also refer to nonexistent FTS rows. | 894 // properly. Have the visits also refer to nonexistent FTS rows. |
894 // | 895 // |
895 // Maybe also refer to invalid favicons. | 896 // Maybe also refer to invalid favicons. |
896 | 897 |
897 } // namespace history | 898 } // namespace history |
OLD | NEW |