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 "chrome/browser/history/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 base::StringAppendF(&debug_info, "SQLITE_CORRUPT, integrity_check:\n"); | 133 base::StringAppendF(&debug_info, "SQLITE_CORRUPT, integrity_check:\n"); |
134 | 134 |
135 // Check files up to 8M to keep things from blocking too long. | 135 // Check files up to 8M to keep things from blocking too long. |
136 const size_t kMaxIntegrityCheckSize = 8192; | 136 const size_t kMaxIntegrityCheckSize = 8192; |
137 if (startup_kb > kMaxIntegrityCheckSize) { | 137 if (startup_kb > kMaxIntegrityCheckSize) { |
138 base::StringAppendF(&debug_info, "too big %" PRIuS "\n", startup_kb); | 138 base::StringAppendF(&debug_info, "too big %" PRIuS "\n", startup_kb); |
139 } else { | 139 } else { |
140 std::vector<std::string> messages; | 140 std::vector<std::string> messages; |
141 | 141 |
142 const base::TimeTicks before = base::TimeTicks::Now(); | 142 const base::TimeTicks before = base::TimeTicks::Now(); |
143 db->IntegrityCheck(&messages); | 143 db->FullIntegrityCheck(&messages); |
michaeln
2013/12/09 19:15:51
ooops, have to check the return value here
Scott Hess - ex-Googler
2013/12/09 20:27:27
FYI, IntegrityCheck() was only added for this code
| |
144 base::StringAppendF(&debug_info, "# %" PRIx64 " ms, %" PRIuS " records\n", | 144 base::StringAppendF(&debug_info, "# %" PRIx64 " ms, %" PRIuS " records\n", |
145 (base::TimeTicks::Now() - before).InMilliseconds(), | 145 (base::TimeTicks::Now() - before).InMilliseconds(), |
146 messages.size()); | 146 messages.size()); |
147 | 147 |
148 // SQLite returns up to 100 messages by default, trim deeper to | 148 // SQLite returns up to 100 messages by default, trim deeper to |
149 // keep close to the 2000-character size limit for dumping. | 149 // keep close to the 2000-character size limit for dumping. |
150 // | 150 // |
151 // TODO(shess): If the first 20 tend to be actionable, test if | 151 // TODO(shess): If the first 20 tend to be actionable, test if |
152 // passing the count to integrity_check makes it exit earlier. In | 152 // passing the count to integrity_check makes it exit earlier. In |
153 // that case it may be possible to greatly ease the size | 153 // that case it may be possible to greatly ease the size |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1427 meta_table_.SetVersionNumber(7); | 1427 meta_table_.SetVersionNumber(7); |
1428 meta_table_.SetCompatibleVersionNumber(std::min(7, kCompatibleVersionNumber)); | 1428 meta_table_.SetCompatibleVersionNumber(std::min(7, kCompatibleVersionNumber)); |
1429 return true; | 1429 return true; |
1430 } | 1430 } |
1431 | 1431 |
1432 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { | 1432 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { |
1433 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); | 1433 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); |
1434 } | 1434 } |
1435 | 1435 |
1436 } // namespace history | 1436 } // namespace history |
OLD | NEW |