Crashpad
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
crashpad::Settings Class Reference

An interface for accessing and modifying the settings of a CrashReportDatabase. More...

#include "client/settings.h"

Classes

struct  Data
 

Public Member Functions

 Settings (const Settings &)=delete
 
Settingsoperator= (const Settings &)=delete
 
bool Initialize (const base::FilePath &path)
 Initializes the settings data store.
 
bool GetClientID (UUID *client_id)
 Retrieves the immutable identifier for this client, which is used on a server to locate all crash reports from a specific Crashpad database.
 
bool GetUploadsEnabled (bool *enabled)
 Retrieves the user’s preference for submitting crash reports to a collection server.
 
bool SetUploadsEnabled (bool enabled)
 Sets the user’s preference for submitting crash reports to a collection server.
 
bool GetLastUploadAttemptTime (time_t *time)
 Retrieves the last time at which a report was attempted to be uploaded.
 
bool SetLastUploadAttemptTime (time_t time)
 Sets the last time at which a report was attempted to be uploaded.
 

Static Public Member Functions

static bool IsLockExpired (const base::FilePath &file_path, time_t lockfile_ttl)
 Returns whether the lockfile for a file is expired.
 

Static Public Attributes

static constexpr char kLockfileExtension [] = ".__lock__"
 

Detailed Description

An interface for accessing and modifying the settings of a CrashReportDatabase.

This class must not be instantiated directly, but rather an instance of it should be retrieved via CrashReportDatabase::GetSettings().

Member Function Documentation

◆ GetClientID()

bool crashpad::Settings::GetClientID ( UUID * client_id)

Retrieves the immutable identifier for this client, which is used on a server to locate all crash reports from a specific Crashpad database.

This is automatically initialized when the database is created.

Parameters
[out]client_idThe unique client identifier.
Returns
On success, returns true, otherwise returns false with an error logged.

◆ GetLastUploadAttemptTime()

bool crashpad::Settings::GetLastUploadAttemptTime ( time_t * time)

Retrieves the last time at which a report was attempted to be uploaded.

The default value is 0 if it has never been set before.

Parameters
[out]timeThe last time at which a report was uploaded.
Returns
On success, returns true, otherwise returns false with an error logged.

◆ GetUploadsEnabled()

bool crashpad::Settings::GetUploadsEnabled ( bool * enabled)

Retrieves the user’s preference for submitting crash reports to a collection server.

The default value is false.

Note
This setting is ignored if –use-cros-crash-reporter is present (which it will be if invoked by Chrome on ChromeOS).
Parameters
[out]enabledWhether crash reports should be uploaded.
Returns
On success, returns true, otherwise returns false with an error logged.

◆ Initialize()

bool crashpad::Settings::Initialize ( const base::FilePath & path)

Initializes the settings data store.

This method must be called only once, and must be successfully called before any other method in this class may be called.

Parameters
[in]pathThe location to store the settings data.
Returns
true if the data store was initialized successfully, otherwise false with an error logged.

◆ IsLockExpired()

bool crashpad::Settings::IsLockExpired ( const base::FilePath & file_path,
time_t lockfile_ttl )
static

Returns whether the lockfile for a file is expired.

This could be part of ScopedLockedFileHandle, but this needs to be public while ScopedLockedFileHandle is private to Settings.

Parameters
[in]file_pathThe path to the file whose lockfile will be checked.
[in]lockfile_ttlHow long the lockfile has to live before expiring.
Returns
true if the lock for the file is expired, otherwise false.

◆ SetLastUploadAttemptTime()

bool crashpad::Settings::SetLastUploadAttemptTime ( time_t time)

Sets the last time at which a report was attempted to be uploaded.

This is only meant to be used internally by the CrashReportDatabase.

Parameters
[in]timeThe last time at which a report was uploaded.
Returns
On success, returns true, otherwise returns false with an error logged.

◆ SetUploadsEnabled()

bool crashpad::Settings::SetUploadsEnabled ( bool enabled)

Sets the user’s preference for submitting crash reports to a collection server.

Parameters
[in]enabledWhether crash reports should be uploaded.
Returns
On success, returns true, otherwise returns false with an error logged.

The documentation for this class was generated from the following files: