BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync / glue / chrome_report_unrecoverable_error.cc
blob4815203abcc5a7ce3e07536e38ddbcb8e340cc2c
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.
5 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
7 #include "base/debug/dump_without_crashing.h"
8 #include "base/rand_util.h"
9 #include "chrome/common/channel_info.h"
10 #include "chrome/common/chrome_constants.h"
11 #include "components/version_info/version_info.h"
13 namespace browser_sync {
15 void ChromeReportUnrecoverableError() {
16 // Only upload on canary/dev builds to avoid overwhelming crash server.
17 version_info::Channel channel = chrome::GetChannel();
18 if (channel != version_info::Channel::CANARY &&
19 channel != version_info::Channel::DEV) {
20 return;
23 // We only want to upload |kErrorUploadRatio| ratio of errors.
24 const double kErrorUploadRatio = 0.01;
25 if (kErrorUploadRatio <= 0.0)
26 return; // We are not allowed to upload errors.
27 double random_number = base::RandDouble();
28 if (random_number > kErrorUploadRatio)
29 return;
31 base::debug::DumpWithoutCrashing();
34 } // namespace browser_sync