• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2016 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36 
37 #ifndef CEF_INCLUDE_CEF_CRASH_UTIL_H_
38 #define CEF_INCLUDE_CEF_CRASH_UTIL_H_
39 #pragma once
40 
41 ///
42 // Crash reporting is configured using an INI-style config file named
43 // "crash_reporter.cfg". On Windows and Linux this file must be placed next to
44 // the main application executable. On macOS this file must be placed in the
45 // top-level app bundle Resources directory (e.g.
46 // "<appname>.app/Contents/Resources"). File contents are as follows:
47 //
48 //  # Comments start with a hash character and must be on their own line.
49 //
50 //  [Config]
51 //  ProductName=<Value of the "prod" crash key; defaults to "cef">
52 //  ProductVersion=<Value of the "ver" crash key; defaults to the CEF version>
53 //  AppName=<Windows only; App-specific folder name component for storing crash
54 //           information; default to "CEF">
55 //  ExternalHandler=<Windows only; Name of the external handler exe to use
56 //                   instead of re-launching the main exe; default to empty>
57 //  BrowserCrashForwardingEnabled=<macOS only; True if browser process crashes
58 //                                 should be forwarded to the system crash
59 //                                 reporter; default to false>
60 //  ServerURL=<crash server URL; default to empty>
61 //  RateLimitEnabled=<True if uploads should be rate limited; default to true>
62 //  MaxUploadsPerDay=<Max uploads per 24 hours, used if rate limit is enabled;
63 //                    default to 5>
64 //  MaxDatabaseSizeInMb=<Total crash report disk usage greater than this value
65 //                       will cause older reports to be deleted; default to 20>
66 //  MaxDatabaseAgeInDays=<Crash reports older than this value will be deleted;
67 //                        default to 5>
68 //
69 //  [CrashKeys]
70 //  my_key1=<small|medium|large>
71 //  my_key2=<small|medium|large>
72 //
73 // Config section:
74 //
75 // If "ProductName" and/or "ProductVersion" are set then the specified values
76 // will be included in the crash dump metadata. On macOS if these values are set
77 // to empty then they will be retrieved from the Info.plist file using the
78 // "CFBundleName" and "CFBundleShortVersionString" keys respectively.
79 //
80 // If "AppName" is set on Windows then crash report information (metrics,
81 // database and dumps) will be stored locally on disk under the
82 // "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder. On other
83 // platforms the CefSettings.user_data_path value will be used.
84 //
85 // If "ExternalHandler" is set on Windows then the specified exe will be
86 // launched as the crashpad-handler instead of re-launching the main process
87 // exe. The value can be an absolute path or a path relative to the main exe
88 // directory. On Linux the CefSettings.browser_subprocess_path value will be
89 // used. On macOS the existing subprocess app bundle will be used.
90 //
91 // If "BrowserCrashForwardingEnabled" is set to true on macOS then browser
92 // process crashes will be forwarded to the system crash reporter. This results
93 // in the crash UI dialog being displayed to the user and crash reports being
94 // logged under "~/Library/Logs/DiagnosticReports". Forwarding of crash reports
95 // from non-browser processes and Debug builds is always disabled.
96 //
97 // If "ServerURL" is set then crashes will be uploaded as a multi-part POST
98 // request to the specified URL. Otherwise, reports will only be stored locally
99 // on disk.
100 //
101 // If "RateLimitEnabled" is set to true then crash report uploads will be rate
102 // limited as follows:
103 //  1. If "MaxUploadsPerDay" is set to a positive value then at most the
104 //     specified number of crashes will be uploaded in each 24 hour period.
105 //  2. If crash upload fails due to a network or server error then an
106 //     incremental backoff delay up to a maximum of 24 hours will be applied for
107 //     retries.
108 //  3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the
109 //     "MaxUploadsPerDay" value will be reduced to 1 until the client is
110 //     restarted. This helps to avoid an upload flood when the network or
111 //     server error is resolved.
112 // Rate limiting is not supported on Linux.
113 //
114 // If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage
115 // on disk will be limited to that size in megabytes. For example, on Windows
116 // each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to
117 // about 34 crash reports stored on disk. Not supported on Linux.
118 //
119 // If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older
120 // than the specified age in days will be deleted. Not supported on Linux.
121 //
122 // CrashKeys section:
123 //
124 // A maximum of 26 crash keys of each size can be specified for use by the
125 // application. Crash key values will be truncated based on the specified size
126 // (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
127 // crash keys can be set from any thread or process using the
128 // CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
129 // server along with the crash dump file.
130 ///
131 /*--cef()--*/
132 bool CefCrashReportingEnabled();
133 
134 #include "include/cef_base.h"
135 
136 ///
137 // Sets or clears a specific key-value pair from the crash metadata.
138 ///
139 /*--cef(optional_param=value)--*/
140 void CefSetCrashKeyValue(const CefString& key, const CefString& value);
141 
142 #endif  // CEF_INCLUDE_CEF_CRASH_UTIL_H_
143