| 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/content/precache_manager.h" | 5 #include "components/precache/content/precache_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 116 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 117 | 117 |
| 118 if (is_precaching_) { | 118 if (is_precaching_) { |
| 119 DLOG(WARNING) << "Cannot start precaching because precaching is already " | 119 DLOG(WARNING) << "Cannot start precaching because precaching is already " |
| 120 "in progress."; | 120 "in progress."; |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 precache_completion_callback_ = precache_completion_callback; | 123 precache_completion_callback_ = precache_completion_callback; |
| 124 | 124 |
| 125 is_precaching_ = true; | 125 is_precaching_ = true; |
| 126 BrowserThread::PostTask( |
| 127 BrowserThread::DB, FROM_HERE, |
| 128 base::Bind(&PrecacheDatabase::SetLastPrecacheTimestamp, |
| 129 base::Unretained(precache_database_.get()), |
| 130 base::Time::Now())); |
| 126 BrowserThread::PostTaskAndReplyWithResult( | 131 BrowserThread::PostTaskAndReplyWithResult( |
| 127 BrowserThread::DB, | 132 BrowserThread::DB, |
| 128 FROM_HERE, | 133 FROM_HERE, |
| 129 base::Bind(&PrecacheDatabase::GetUnfinishedWork, | 134 base::Bind(&PrecacheDatabase::GetUnfinishedWork, |
| 130 base::Unretained(precache_database_.get())), | 135 base::Unretained(precache_database_.get())), |
| 131 base::Bind(&PrecacheManager::OnGetUnfinishedWorkDone, AsWeakPtr())); | 136 base::Bind(&PrecacheManager::OnGetUnfinishedWorkDone, AsWeakPtr())); |
| 132 } | 137 } |
| 133 | 138 |
| 134 void PrecacheManager::OnGetUnfinishedWorkDone( | 139 void PrecacheManager::OnGetUnfinishedWorkDone( |
| 135 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work) { | 140 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 this)); | 333 this)); |
| 329 precache_fetcher_->Start(); | 334 precache_fetcher_->Start(); |
| 330 } | 335 } |
| 331 | 336 |
| 332 void PrecacheManager::OnHostsReceivedThenDone( | 337 void PrecacheManager::OnHostsReceivedThenDone( |
| 333 const history::TopHostsList& host_counts) { | 338 const history::TopHostsList& host_counts) { |
| 334 OnDone(); | 339 OnDone(); |
| 335 } | 340 } |
| 336 | 341 |
| 337 } // namespace precache | 342 } // namespace precache |
| OLD | NEW |