| 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/download_database.h" | 5 #include "chrome/browser/history/download_database.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 static const int kStateComplete = 1; | 49 static const int kStateComplete = 1; |
| 50 static const int kStateCancelled = 2; | 50 static const int kStateCancelled = 2; |
| 51 static const int kStateBug140687 = 3; | 51 static const int kStateBug140687 = 3; |
| 52 static const int kStateInterrupted = 4; | 52 static const int kStateInterrupted = 4; |
| 53 | 53 |
| 54 int StateToInt(DownloadItem::DownloadState state) { | 54 int StateToInt(DownloadItem::DownloadState state) { |
| 55 switch (state) { | 55 switch (state) { |
| 56 case DownloadItem::IN_PROGRESS: return kStateInProgress; | 56 case DownloadItem::IN_PROGRESS: return kStateInProgress; |
| 57 case DownloadItem::COMPLETE: return kStateComplete; | 57 case DownloadItem::COMPLETE: return kStateComplete; |
| 58 case DownloadItem::CANCELLED: return kStateCancelled; | 58 case DownloadItem::CANCELLED: return kStateCancelled; |
| 59 case DownloadItem::REMOVING: return kStateInvalid; | |
| 60 case DownloadItem::INTERRUPTED: return kStateInterrupted; | 59 case DownloadItem::INTERRUPTED: return kStateInterrupted; |
| 61 case DownloadItem::MAX_DOWNLOAD_STATE: return kStateInvalid; | 60 case DownloadItem::MAX_DOWNLOAD_STATE: return kStateInvalid; |
| 62 default: return kStateInvalid; | 61 default: return kStateInvalid; |
| 63 } | 62 } |
| 64 } | 63 } |
| 65 | 64 |
| 66 DownloadItem::DownloadState IntToState(int state) { | 65 DownloadItem::DownloadState IntToState(int state) { |
| 67 switch (state) { | 66 switch (state) { |
| 68 case kStateInProgress: return DownloadItem::IN_PROGRESS; | 67 case kStateInProgress: return DownloadItem::IN_PROGRESS; |
| 69 case kStateComplete: return DownloadItem::COMPLETE; | 68 case kStateComplete: return DownloadItem::COMPLETE; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (num_downloads_deleted > 0) { | 340 if (num_downloads_deleted > 0) { |
| 342 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTimePerRecord", | 341 UMA_HISTOGRAM_TIMES("Download.DatabaseRemoveDownloadsTimePerRecord", |
| 343 (1000 * micros) / num_downloads_deleted); | 342 (1000 * micros) / num_downloads_deleted); |
| 344 } | 343 } |
| 345 } | 344 } |
| 346 | 345 |
| 347 return success; | 346 return success; |
| 348 } | 347 } |
| 349 | 348 |
| 350 } // namespace history | 349 } // namespace history |
| OLD | NEW |