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 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1172 if (!db_) | 1172 if (!db_) |
1173 return; | 1173 return; |
1174 db_->UpdateDownload(data); | 1174 db_->UpdateDownload(data); |
1175 ScheduleCommit(); | 1175 ScheduleCommit(); |
1176 } | 1176 } |
1177 | 1177 |
1178 bool HistoryBackend::CreateDownload(const DownloadRow& history_info) { | 1178 bool HistoryBackend::CreateDownload(const DownloadRow& history_info) { |
1179 if (!db_) | 1179 if (!db_) |
1180 return false; | 1180 return false; |
1181 bool success = db_->CreateDownload(history_info); | 1181 bool success = db_->CreateDownload(history_info); |
1182 #if defined(OS_ANDROID) | |
1183 Commit(); | |
sky
2016/08/29 22:58:05
Please add a comment here as to why this is specia
qinmin
2016/08/30 00:08:06
Done.
| |
1184 #else | |
1182 ScheduleCommit(); | 1185 ScheduleCommit(); |
1186 #endif | |
1183 return success; | 1187 return success; |
1184 } | 1188 } |
1185 | 1189 |
1186 void HistoryBackend::RemoveDownloads(const std::set<uint32_t>& ids) { | 1190 void HistoryBackend::RemoveDownloads(const std::set<uint32_t>& ids) { |
1187 if (!db_) | 1191 if (!db_) |
1188 return; | 1192 return; |
1189 size_t downloads_count_before = db_->CountDownloads(); | 1193 size_t downloads_count_before = db_->CountDownloads(); |
1190 base::TimeTicks started_removing = base::TimeTicks::Now(); | 1194 base::TimeTicks started_removing = base::TimeTicks::Now(); |
1191 // HistoryBackend uses a long-running Transaction that is committed | 1195 // HistoryBackend uses a long-running Transaction that is committed |
1192 // periodically, so this loop doesn't actually hit the disk too hard. | 1196 // periodically, so this loop doesn't actually hit the disk too hard. |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2629 // transaction is currently open. | 2633 // transaction is currently open. |
2630 db_->CommitTransaction(); | 2634 db_->CommitTransaction(); |
2631 db_->Vacuum(); | 2635 db_->Vacuum(); |
2632 db_->BeginTransaction(); | 2636 db_->BeginTransaction(); |
2633 db_->GetStartDate(&first_recorded_time_); | 2637 db_->GetStartDate(&first_recorded_time_); |
2634 | 2638 |
2635 return true; | 2639 return true; |
2636 } | 2640 } |
2637 | 2641 |
2638 } // namespace history | 2642 } // namespace history |
OLD | NEW |