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