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/metrics/metrics_log_serializer.h" | 5 #include "chrome/browser/metrics/metrics_log_serializer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/prefs/scoped_user_pref_update.h" | 13 #include "base/prefs/scoped_user_pref_update.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
16 | 16 |
| 17 using metrics::MetricsLogBase; |
| 18 using metrics::MetricsLogManager; |
| 19 |
17 namespace { | 20 namespace { |
18 | 21 |
19 // The number of "initial" logs to save, and hope to send during a future Chrome | 22 // The number of "initial" logs to save, and hope to send during a future Chrome |
20 // session. Initial logs contain crash stats, and are pretty small. | 23 // session. Initial logs contain crash stats, and are pretty small. |
21 const size_t kInitialLogsPersistLimit = 20; | 24 const size_t kInitialLogsPersistLimit = 20; |
22 | 25 |
23 // The number of ongoing logs to save persistently, and hope to | 26 // The number of ongoing logs to save persistently, and hope to |
24 // send during a this or future sessions. Note that each log may be pretty | 27 // send during a this or future sessions. Note that each log may be pretty |
25 // large, as presumably the related "initial" log wasn't sent (probably nothing | 28 // large, as presumably the related "initial" log wasn't sent (probably nothing |
26 // was, as the user was probably off-line). As a result, the log probably kept | 29 // was, as the user was probably off-line). As a result, the log probably kept |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 if (!valid) { | 217 if (!valid) { |
215 local_list->clear(); | 218 local_list->clear(); |
216 return MakeRecallStatusHistogram(CHECKSUM_STRING_CORRUPTION); | 219 return MakeRecallStatusHistogram(CHECKSUM_STRING_CORRUPTION); |
217 } | 220 } |
218 if (recovered_md5 != base::MD5DigestToBase16(digest)) { | 221 if (recovered_md5 != base::MD5DigestToBase16(digest)) { |
219 local_list->clear(); | 222 local_list->clear(); |
220 return MakeRecallStatusHistogram(CHECKSUM_CORRUPTION); | 223 return MakeRecallStatusHistogram(CHECKSUM_CORRUPTION); |
221 } | 224 } |
222 return MakeRecallStatusHistogram(RECALL_SUCCESS); | 225 return MakeRecallStatusHistogram(RECALL_SUCCESS); |
223 } | 226 } |
OLD | NEW |