| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/offline_pages/offline_page_metadata_store_sql.h" | 5 #include "components/offline_pages/offline_page_metadata_store_sql.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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 void OfflinePageMetadataStoreSQL::NotifyLoadResult( | 269 void OfflinePageMetadataStoreSQL::NotifyLoadResult( |
| 270 scoped_refptr<base::SingleThreadTaskRunner> runner, | 270 scoped_refptr<base::SingleThreadTaskRunner> runner, |
| 271 const LoadCallback& callback, | 271 const LoadCallback& callback, |
| 272 LoadStatus status, | 272 LoadStatus status, |
| 273 const std::vector<OfflinePageItem>& result) { | 273 const std::vector<OfflinePageItem>& result) { |
| 274 // TODO(bburns): Switch to SQL specific UMA metrics. | 274 // TODO(bburns): Switch to SQL specific UMA metrics. |
| 275 UMA_HISTOGRAM_ENUMERATION("OfflinePages.LoadStatus", status, | 275 UMA_HISTOGRAM_ENUMERATION("OfflinePages.LoadStatus", status, |
| 276 OfflinePageMetadataStore::LOAD_STATUS_COUNT); | 276 OfflinePageMetadataStore::LOAD_STATUS_COUNT); |
| 277 if (status == LOAD_SUCCEEDED) { | 277 if (status == LOAD_SUCCEEDED) { |
| 278 UMA_HISTOGRAM_COUNTS("OfflinePages.SavedPageCount", result.size()); | 278 UMA_HISTOGRAM_COUNTS("OfflinePages.SavedPageCount", |
| 279 static_cast<int32_t>(result.size())); |
| 279 } else { | 280 } else { |
| 280 DVLOG(1) << "Offline pages database loading failed: " << status; | 281 DVLOG(1) << "Offline pages database loading failed: " << status; |
| 281 } | 282 } |
| 282 runner->PostTask(FROM_HERE, base::Bind(callback, status, result)); | 283 runner->PostTask(FROM_HERE, base::Bind(callback, status, result)); |
| 283 } | 284 } |
| 284 | 285 |
| 285 void OfflinePageMetadataStoreSQL::Load(const LoadCallback& callback) { | 286 void OfflinePageMetadataStoreSQL::Load(const LoadCallback& callback) { |
| 286 db_.reset(new sql::Connection()); | 287 db_.reset(new sql::Connection()); |
| 287 background_task_runner_->PostTask( | 288 background_task_runner_->PostTask( |
| 288 FROM_HERE, | 289 FROM_HERE, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 } | 323 } |
| 323 | 324 |
| 324 void OfflinePageMetadataStoreSQL::Reset(const ResetCallback& callback) { | 325 void OfflinePageMetadataStoreSQL::Reset(const ResetCallback& callback) { |
| 325 background_task_runner_->PostTask( | 326 background_task_runner_->PostTask( |
| 326 FROM_HERE, | 327 FROM_HERE, |
| 327 base::Bind(&OfflinePageMetadataStoreSQL::ResetSync, base::Passed(&db_), | 328 base::Bind(&OfflinePageMetadataStoreSQL::ResetSync, base::Passed(&db_), |
| 328 base::ThreadTaskRunnerHandle::Get(), callback)); | 329 base::ThreadTaskRunnerHandle::Get(), callback)); |
| 329 } | 330 } |
| 330 | 331 |
| 331 } // namespace offline_pages | 332 } // namespace offline_pages |
| OLD | NEW |