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 "components/sync/driver/glue/chrome_report_unrecoverable_error.h" | 5 #include "components/sync/driver/glue/chrome_report_unrecoverable_error.h" |
6 | 6 |
7 #include "base/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 | 9 |
10 namespace browser_sync { | 10 namespace syncer { |
11 | 11 |
12 void ChromeReportUnrecoverableError(version_info::Channel channel) { | 12 void ChromeReportUnrecoverableError(version_info::Channel channel) { |
13 // Only upload on canary/dev builds to avoid overwhelming crash server. | 13 // Only upload on canary/dev builds to avoid overwhelming crash server. |
14 if (channel != version_info::Channel::CANARY && | 14 if (channel != version_info::Channel::CANARY && |
15 channel != version_info::Channel::DEV) { | 15 channel != version_info::Channel::DEV) { |
16 return; | 16 return; |
17 } | 17 } |
18 | 18 |
19 // We only want to upload |kErrorUploadRatio| ratio of errors. | 19 // We only want to upload |kErrorUploadRatio| ratio of errors. |
20 const double kErrorUploadRatio = 0.01; | 20 const double kErrorUploadRatio = 0.01; |
21 if (kErrorUploadRatio <= 0.0) | 21 if (kErrorUploadRatio <= 0.0) |
22 return; // We are not allowed to upload errors. | 22 return; // We are not allowed to upload errors. |
23 double random_number = base::RandDouble(); | 23 double random_number = base::RandDouble(); |
24 if (random_number > kErrorUploadRatio) | 24 if (random_number > kErrorUploadRatio) |
25 return; | 25 return; |
26 | 26 |
27 base::debug::DumpWithoutCrashing(); | 27 base::debug::DumpWithoutCrashing(); |
28 } | 28 } |
29 | 29 |
30 } // namespace browser_sync | 30 } // namespace syncer |
OLD | NEW |