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