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/rand_util.h"
8 #include "build/build_config.h"
14 #include "chrome/common/chrome_constants.h"
16 namespace browser_sync
{
18 static const double kErrorUploadRatio
= 0.15;
19 void ChromeReportUnrecoverableError() {
20 // TODO(lipalani): Add this for other platforms as well.
22 // We only want to upload |kErrorUploadRatio| ratio of errors.
23 if (kErrorUploadRatio
<= 0.0)
24 return; // We are not allowed to upload errors.
25 double random_number
= base::RandDouble();
26 if (random_number
> kErrorUploadRatio
)
29 // Get the breakpad pointer from chrome.exe
30 typedef void (__cdecl
*DumpProcessFunction
)();
31 DumpProcessFunction DumpProcess
= reinterpret_cast<DumpProcessFunction
>(
32 ::GetProcAddress(::GetModuleHandle(
33 chrome::kBrowserProcessExecutableName
),
34 "DumpProcessWithoutCrash"));
41 } // namespace browser_sync