| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | |
| 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | |
| 7 | |
| 8 #include <time.h> | |
| 9 | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 13 namespace crash_reporter { | |
| 14 | |
| 15 // Initializes Crashpad in a way that is appropriate for initial_client and | |
| 16 // process_type. | |
| 17 // | |
| 18 // If initial_client is true, this starts crashpad_handler and sets it as the | |
| 19 // exception handler. Child processes will inherit this exception handler, and | |
| 20 // should specify false for this parameter. Although they inherit the exception | |
| 21 // handler, child processes still need to call this function to perform | |
| 22 // additional initialization. | |
| 23 // | |
| 24 // If process_type is empty, initialization will be done for the browser | |
| 25 // process. The browser process performs additional initialization of the crash | |
| 26 // report database. The browser process is also the only process type that is | |
| 27 // eligible to have its crashes forwarded to the system crash report handler (in | |
| 28 // release mode only). Note that when process_type is empty, initial_client must | |
| 29 // be true. | |
| 30 // | |
| 31 // process_type may be non-empty with initial_client set to true. This indicates | |
| 32 // that an exception handler has been inherited but should be discarded in favor | |
| 33 // of a new Crashpad handler. This configuration should be used infrequently. It | |
| 34 // is provided to allow an install-from-.dmg relauncher process to disassociate | |
| 35 // from an old Crashpad handler so that after performing an installation from a | |
| 36 // disk image, the relauncher process may unmount the disk image that contains | |
| 37 // its inherited crashpad_handler. This is only supported when initial_client is | |
| 38 // true and process_type is "relauncher". | |
| 39 void InitializeCrashpad(bool initial_client, const std::string& process_type); | |
| 40 | |
| 41 // Enables or disables crash report upload. This is a property of the Crashpad | |
| 42 // database. In a newly-created database, uploads will be disabled. This | |
| 43 // function only has an effect when called in the browser process. Its effect is | |
| 44 // immediate and applies to all other process types, including processes that | |
| 45 // are already running. | |
| 46 void SetUploadsEnabled(bool enabled); | |
| 47 | |
| 48 // Determines whether uploads are enabled or disabled. This information is only | |
| 49 // available in the browser process. | |
| 50 bool GetUploadsEnabled(); | |
| 51 | |
| 52 struct UploadedReport { | |
| 53 std::string local_id; | |
| 54 std::string remote_id; | |
| 55 time_t creation_time; | |
| 56 }; | |
| 57 | |
| 58 // Obtains a list of reports uploaded to the collection server. This function | |
| 59 // only operates when called in the browser process. All reports in the Crashpad | |
| 60 // database that have been successfully uploaded will be included in this list. | |
| 61 // The list will be sorted in descending order by report creation time (newest | |
| 62 // reports first). | |
| 63 // | |
| 64 // TODO(mark): The about:crashes UI expects to show only uploaded reports. If it | |
| 65 // is ever enhanced to work well with un-uploaded reports, those should be | |
| 66 // returned as well. Un-uploaded reports may have a pending upload, may have | |
| 67 // experienced upload failure, or may have been collected while uploads were | |
| 68 // disabled. | |
| 69 void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports); | |
| 70 | |
| 71 } // namespace crash_reporter | |
| 72 | |
| 73 #endif // COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | |
| OLD | NEW |