| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | 5 #ifndef COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ |
| 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | 6 #define COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ |
| 7 | 7 |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" |
| 14 |
| 13 namespace crash_reporter { | 15 namespace crash_reporter { |
| 14 | 16 |
| 15 // Initializes Crashpad in a way that is appropriate for initial_client and | 17 // Initializes Crashpad in a way that is appropriate for initial_client and |
| 16 // process_type. | 18 // process_type. |
| 17 // | 19 // |
| 18 // If initial_client is true, this starts crashpad_handler and sets it as the | 20 // 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 | 21 // exception handler. Child processes will inherit this exception handler, and |
| 20 // should specify false for this parameter. Although they inherit the exception | 22 // should specify false for this parameter. Although they inherit the exception |
| 21 // handler, child processes still need to call this function to perform | 23 // handler, child processes still need to call this function to perform |
| 22 // additional initialization. | 24 // additional initialization. |
| 23 // | 25 // |
| 24 // If process_type is empty, initialization will be done for the browser | 26 // If process_type is empty, initialization will be done for the browser |
| 25 // process. The browser process performs additional initialization of the crash | 27 // process. The browser process performs additional initialization of the crash |
| 26 // report database. The browser process is also the only process type that is | 28 // 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 | 29 // 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 | 30 // release mode only). Note that when process_type is empty, initial_client must |
| 29 // be true. | 31 // be true. |
| 30 // | 32 // |
| 31 // process_type may be non-empty with initial_client set to true. This indicates | 33 // On Mac, process_type may be non-empty with initial_client set to true. This |
| 32 // that an exception handler has been inherited but should be discarded in favor | 34 // indicates that an exception handler has been inherited but should be |
| 33 // of a new Crashpad handler. This configuration should be used infrequently. It | 35 // discarded in favor of a new Crashpad handler. This configuration should be |
| 34 // is provided to allow an install-from-.dmg relauncher process to disassociate | 36 // used infrequently. It is provided to allow an install-from-.dmg relauncher |
| 35 // from an old Crashpad handler so that after performing an installation from a | 37 // process to disassociate from an old Crashpad handler so that after performing |
| 36 // disk image, the relauncher process may unmount the disk image that contains | 38 // an installation from a disk image, the relauncher process may unmount the |
| 37 // its inherited crashpad_handler. This is only supported when initial_client is | 39 // disk image that contains its inherited crashpad_handler. This is only |
| 38 // true and process_type is "relauncher". | 40 // supported when initial_client is true and process_type is "relauncher". |
| 39 void InitializeCrashpad(bool initial_client, const std::string& process_type); | 41 void InitializeCrashpad(bool initial_client, const std::string& process_type); |
| 40 | 42 |
| 41 // Enables or disables crash report upload. This is a property of the Crashpad | 43 // 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 | 44 // 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 | 45 // 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 | 46 // immediate and applies to all other process types, including processes that |
| 45 // are already running. | 47 // are already running. |
| 46 void SetUploadsEnabled(bool enabled); | 48 void SetUploadsEnabled(bool enabled); |
| 47 | 49 |
| 48 // Determines whether uploads are enabled or disabled. This information is only | 50 // Determines whether uploads are enabled or disabled. This information is only |
| (...skipping 12 matching lines...) Expand all Loading... |
| 61 // The list will be sorted in descending order by report creation time (newest | 63 // The list will be sorted in descending order by report creation time (newest |
| 62 // reports first). | 64 // reports first). |
| 63 // | 65 // |
| 64 // TODO(mark): The about:crashes UI expects to show only uploaded reports. If it | 66 // 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 | 67 // 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 | 68 // 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 | 69 // experienced upload failure, or may have been collected while uploads were |
| 68 // disabled. | 70 // disabled. |
| 69 void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports); | 71 void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports); |
| 70 | 72 |
| 73 namespace internal { |
| 74 |
| 75 // The platform-specific portion of InitializeCrashpad(). |
| 76 // Returns the database path, if initializing in the browser process. |
| 77 base::FilePath PlatformCrashpadInitialization(bool initial_client, |
| 78 bool browser_process); |
| 79 |
| 80 } // namespace internal |
| 81 |
| 71 } // namespace crash_reporter | 82 } // namespace crash_reporter |
| 72 | 83 |
| 73 #endif // COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ | 84 #endif // COMPONENTS_CRASH_CONTENT_APP_CRASHPAD_MAC_H_ |
| OLD | NEW |