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/history_database.h" | 5 #include "chrome/browser/history/history_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "content/public/browser/download_interrupt_reasons.h" | |
17 #include "sql/transaction.h" | 18 #include "sql/transaction.h" |
18 | 19 |
19 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
20 #include "base/mac/mac_util.h" | 21 #include "base/mac/mac_util.h" |
21 #endif | 22 #endif |
22 | 23 |
23 namespace history { | 24 namespace history { |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // Current version number. We write databases at the "current" version number, | 28 // Current version number. We write databases at the "current" version number, |
28 // but any previous version that can read the "compatible" one can make do with | 29 // but any previous version that can read the "compatible" one can make do with |
29 // our database without *too* many bad effects. | 30 // our database without *too* many bad effects. |
30 const int kCurrentVersionNumber = 29; | 31 const int kCurrentVersionNumber = 29; |
31 const int kCompatibleVersionNumber = 16; | 32 const int kCompatibleVersionNumber = 16; |
32 const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; | 33 const char kEarlyExpirationThresholdKey[] = "early_expiration_threshold"; |
33 | 34 |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 HistoryDatabase::HistoryDatabase() { | 37 HistoryDatabase::HistoryDatabase() |
38 : DownloadDatabase(static_cast<DownloadInterruptReason>( | |
droger
2015/01/06 10:22:18
Can we use ToHistoryDownloadInterruptReason() here
sdefresne
2015/01/06 10:51:17
Good catch.
| |
39 content::DOWNLOAD_INTERRUPT_REASON_NONE), | |
40 static_cast<DownloadInterruptReason>( | |
41 content::DOWNLOAD_INTERRUPT_REASON_CRASH)) { | |
37 } | 42 } |
38 | 43 |
39 HistoryDatabase::~HistoryDatabase() { | 44 HistoryDatabase::~HistoryDatabase() { |
40 } | 45 } |
41 | 46 |
42 sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name) { | 47 sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name) { |
43 db_.set_histogram_tag("History"); | 48 db_.set_histogram_tag("History"); |
44 | 49 |
45 // Set the exceptional sqlite error handler. | 50 // Set the exceptional sqlite error handler. |
46 db_.set_error_callback(error_callback_); | 51 db_.set_error_callback(error_callback_); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 "SET visit_time = visit_time + 11644473600000000 " | 456 "SET visit_time = visit_time + 11644473600000000 " |
452 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); | 457 "WHERE id IN (SELECT id FROM visits WHERE visit_time > 0);")); |
453 ignore_result(db_.Execute( | 458 ignore_result(db_.Execute( |
454 "UPDATE segment_usage " | 459 "UPDATE segment_usage " |
455 "SET time_slot = time_slot + 11644473600000000 " | 460 "SET time_slot = time_slot + 11644473600000000 " |
456 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); | 461 "WHERE id IN (SELECT id FROM segment_usage WHERE time_slot > 0);")); |
457 } | 462 } |
458 #endif | 463 #endif |
459 | 464 |
460 } // namespace history | 465 } // namespace history |
OLD | NEW |