Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/sync/glue/chrome_report_unrecoverable_error.cc

Issue 24649002: Clean up a few more unused globals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thestig comment Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/rand_util.h" 7 #include "base/rand_util.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
11 #include <windows.h> 11 #include <windows.h>
12 #endif 12 #endif
13 13
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 15
16 namespace browser_sync { 16 namespace browser_sync {
17 17
18 static const double kErrorUploadRatio = 0.15;
19 void ChromeReportUnrecoverableError() { 18 void ChromeReportUnrecoverableError() {
20 // TODO(lipalani): Add this for other platforms as well. 19 // TODO(lipalani): Add this for other platforms as well.
21 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 const double kErrorUploadRatio = 0.15;
22
22 // We only want to upload |kErrorUploadRatio| ratio of errors. 23 // We only want to upload |kErrorUploadRatio| ratio of errors.
23 if (kErrorUploadRatio <= 0.0) 24 if (kErrorUploadRatio <= 0.0)
24 return; // We are not allowed to upload errors. 25 return; // We are not allowed to upload errors.
25 double random_number = base::RandDouble(); 26 double random_number = base::RandDouble();
26 if (random_number > kErrorUploadRatio) 27 if (random_number > kErrorUploadRatio)
27 return; 28 return;
28 29
29 // Get the breakpad pointer from chrome.exe 30 // Get the breakpad pointer from chrome.exe
30 typedef void (__cdecl *DumpProcessFunction)(); 31 typedef void (__cdecl *DumpProcessFunction)();
31 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( 32 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>(
32 ::GetProcAddress(::GetModuleHandle( 33 ::GetProcAddress(::GetModuleHandle(
33 chrome::kBrowserProcessExecutableName), 34 chrome::kBrowserProcessExecutableName),
34 "DumpProcessWithoutCrash")); 35 "DumpProcessWithoutCrash"));
35 if (DumpProcess) 36 if (DumpProcess)
36 DumpProcess(); 37 DumpProcess();
37 #endif // OS_WIN 38 #endif // OS_WIN
38 39
39 } 40 }
40 41
41 } // namespace browser_sync 42 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698