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