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/safe_browsing/safe_browsing_database.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 } | 1561 } |
1562 | 1562 |
1563 void SafeBrowsingDatabaseNew::HandleCorruptDatabase() { | 1563 void SafeBrowsingDatabaseNew::HandleCorruptDatabase() { |
1564 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); | 1564 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); |
1565 | 1565 |
1566 // Reset the database after the current task has unwound (but only | 1566 // Reset the database after the current task has unwound (but only |
1567 // reset once within the scope of a given task). | 1567 // reset once within the scope of a given task). |
1568 if (!reset_factory_.HasWeakPtrs()) { | 1568 if (!reset_factory_.HasWeakPtrs()) { |
1569 RecordFailure(FAILURE_DATABASE_CORRUPT); | 1569 RecordFailure(FAILURE_DATABASE_CORRUPT); |
1570 db_task_runner_->PostTask( | 1570 db_task_runner_->PostTask( |
1571 FROM_HERE, base::Bind(&SafeBrowsingDatabaseNew::OnHandleCorruptDatabase, | 1571 FROM_HERE, |
1572 reset_factory_.GetWeakPtr())); | 1572 base::BindOnce(&SafeBrowsingDatabaseNew::OnHandleCorruptDatabase, |
| 1573 reset_factory_.GetWeakPtr())); |
1573 } | 1574 } |
1574 } | 1575 } |
1575 | 1576 |
1576 void SafeBrowsingDatabaseNew::OnHandleCorruptDatabase() { | 1577 void SafeBrowsingDatabaseNew::OnHandleCorruptDatabase() { |
1577 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); | 1578 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); |
1578 | 1579 |
1579 RecordFailure(FAILURE_DATABASE_CORRUPT_HANDLER); | 1580 RecordFailure(FAILURE_DATABASE_CORRUPT_HANDLER); |
1580 db_state_manager_.set_corruption_detected(); // Stop updating the database. | 1581 db_state_manager_.set_corruption_detected(); // Stop updating the database. |
1581 ResetDatabase(); | 1582 ResetDatabase(); |
1582 | 1583 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 | 1875 |
1875 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro. | 1876 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro. |
1876 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( | 1877 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( |
1877 histogram_name, 1, 1000000, 50, | 1878 histogram_name, 1, 1000000, 50, |
1878 base::HistogramBase::kUmaTargetedHistogramFlag); | 1879 base::HistogramBase::kUmaTargetedHistogramFlag); |
1879 | 1880 |
1880 histogram_pointer->Add(file_size_kilobytes); | 1881 histogram_pointer->Add(file_size_kilobytes); |
1881 } | 1882 } |
1882 | 1883 |
1883 } // namespace safe_browsing | 1884 } // namespace safe_browsing |
OLD | NEW |