| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/precache/core/precache_database.h" | 5 #include "components/precache/core/precache_database.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "components/history/core/browser/history_constants.h" | 14 #include "components/history/core/browser/history_constants.h" |
| 15 #include "sql/connection.h" | 15 #include "sql/connection.h" |
| 16 #include "sql/transaction.h" | 16 #include "sql/transaction.h" |
| 17 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // The number of days old that an entry in the precache URL table can be before | 21 // The number of days old that an entry in the precache URL table can be before |
| 22 // it is considered "old" and is removed from the table. | 22 // it is considered "old" and is removed from the table. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 // database writes can be buffered up and flushed together in the same | 253 // database writes can be buffered up and flushed together in the same |
| 254 // transaction. | 254 // transaction. |
| 255 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 255 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 256 FROM_HERE, base::Bind(&PrecacheDatabase::PostedFlush, | 256 FROM_HERE, base::Bind(&PrecacheDatabase::PostedFlush, |
| 257 weak_factory_.GetWeakPtr()), | 257 weak_factory_.GetWeakPtr()), |
| 258 base::TimeDelta::FromSeconds(1)); | 258 base::TimeDelta::FromSeconds(1)); |
| 259 is_flush_posted_ = true; | 259 is_flush_posted_ = true; |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace precache | 262 } // namespace precache |
| OLD | NEW |