• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h"
6 
7 #include "base/rand_util.h"
8 #include "chrome/common/chrome_constants.h"
9 #include "chrome/common/chrome_version_info.h"
10 #include "chrome/common/dump_without_crashing.h"
11 
12 namespace browser_sync {
13 
ChromeReportUnrecoverableError()14 void ChromeReportUnrecoverableError() {
15   // Only upload on canary/dev builds to avoid overwhelming crash server.
16   chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
17   if (channel != chrome::VersionInfo::CHANNEL_CANARY &&
18       channel != chrome::VersionInfo::CHANNEL_DEV) {
19     return;
20   }
21 
22   // We only want to upload |kErrorUploadRatio| ratio of errors.
23   const double kErrorUploadRatio = 0.0;
24   if (kErrorUploadRatio <= 0.0)
25     return; // We are not allowed to upload errors.
26   double random_number = base::RandDouble();
27   if (random_number > kErrorUploadRatio)
28     return;
29 
30   logging::DumpWithoutCrashing();
31 }
32 
33 }  // namespace browser_sync
34