mirror of
https://github.com/chromium/crashpad.git
synced 2025-01-14 01:08:01 +08:00
ios: Move system data collector to internal.
Also fixes a usage of ->assign in the class which will be unsafe to use. Bug: crashpad:31 Change-Id: I434df35b0669dde2323817f3c0cef1727926c85f Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2650088 Commit-Queue: Justin Cohen <justincohen@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
d4c3de1afa
commit
dc02980481
@ -201,7 +201,7 @@ class CrashHandler : public Thread, public UniversalMachExcServer::Interface {
|
||||
base::mac::ScopedMachReceiveRight exception_port_;
|
||||
ExceptionPorts::ExceptionHandlerVector original_handlers_;
|
||||
struct sigaction old_action_ = {};
|
||||
IOSSystemDataCollector system_data_;
|
||||
internal::IOSSystemDataCollector system_data_;
|
||||
InitializationStateDcheck initialized_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CrashHandler);
|
||||
|
@ -51,7 +51,8 @@ ProcessSnapshotIOS::ProcessSnapshotIOS()
|
||||
|
||||
ProcessSnapshotIOS::~ProcessSnapshotIOS() {}
|
||||
|
||||
bool ProcessSnapshotIOS::Initialize(const IOSSystemDataCollector& system_data) {
|
||||
bool ProcessSnapshotIOS::Initialize(
|
||||
const internal::IOSSystemDataCollector& system_data) {
|
||||
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
|
||||
|
||||
// Used by pid, parent pid and snapshot time.
|
||||
|
@ -42,7 +42,7 @@ class ProcessSnapshotIOS final : public ProcessSnapshot {
|
||||
//!
|
||||
//! \return `true` if the snapshot could be created, `false` otherwise with
|
||||
//! an appropriate message logged.
|
||||
bool Initialize(const IOSSystemDataCollector& system_data);
|
||||
bool Initialize(const internal::IOSSystemDataCollector& system_data);
|
||||
|
||||
//! \brief Initialize exception information from a signal.
|
||||
void SetExceptionFromSignal(const siginfo_t* siginfo,
|
||||
|
@ -60,10 +60,9 @@ SystemSnapshotIOS::~SystemSnapshotIOS() {}
|
||||
void SystemSnapshotIOS::Initialize(const IOSSystemDataCollector& system_data) {
|
||||
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
|
||||
|
||||
system_data.OSVersion(&os_version_major_,
|
||||
&os_version_minor_,
|
||||
&os_version_bugfix_,
|
||||
&os_version_build_);
|
||||
system_data.OSVersion(
|
||||
&os_version_major_, &os_version_minor_, &os_version_bugfix_);
|
||||
os_version_build_ = system_data.Build();
|
||||
machine_description_ = system_data.MachineDescription();
|
||||
cpu_count_ = system_data.ProcessorCount();
|
||||
cpu_vendor_ = system_data.CPUVendor();
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace crashpad {
|
||||
namespace internal {
|
||||
|
||||
//! \brief Used to collect system level data before a crash occurs.
|
||||
class IOSSystemDataCollector {
|
||||
@ -27,9 +28,10 @@ class IOSSystemDataCollector {
|
||||
IOSSystemDataCollector();
|
||||
~IOSSystemDataCollector();
|
||||
|
||||
void OSVersion(int* major, int* minor, int* bugfix, std::string* build) const;
|
||||
void OSVersion(int* major, int* minor, int* bugfix) const;
|
||||
std::string MachineDescription() const { return machine_description_; }
|
||||
int ProcessorCount() const { return processor_count_; }
|
||||
std::string Build() const { return build_; }
|
||||
std::string CPUVendor() const { return cpu_vendor_; }
|
||||
bool HasDaylightSavingTime() const { return has_next_daylight_saving_time_; }
|
||||
bool IsDaylightSavingTime() const { return is_daylight_saving_time_; }
|
||||
@ -76,6 +78,7 @@ class IOSSystemDataCollector {
|
||||
std::string daylight_name_;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace crashpad
|
||||
|
||||
#endif // CRASHPAD_UTIL_IOS_IOS_SYSTEM_DATA_COLLECTOR_H_
|
||||
|
@ -52,6 +52,7 @@ std::string ReadStringSysctlByName(const char* name) {
|
||||
} // namespace
|
||||
|
||||
namespace crashpad {
|
||||
namespace internal {
|
||||
|
||||
IOSSystemDataCollector::IOSSystemDataCollector()
|
||||
: major_version_(0),
|
||||
@ -119,12 +120,10 @@ IOSSystemDataCollector::~IOSSystemDataCollector() {
|
||||
|
||||
void IOSSystemDataCollector::OSVersion(int* major,
|
||||
int* minor,
|
||||
int* bugfix,
|
||||
std::string* build) const {
|
||||
int* bugfix) const {
|
||||
*major = major_version_;
|
||||
*minor = minor_version_;
|
||||
*bugfix = patch_version_;
|
||||
build->assign(build_);
|
||||
}
|
||||
|
||||
void IOSSystemDataCollector::InstallHandlers() {
|
||||
@ -211,4 +210,5 @@ void IOSSystemDataCollector::OrientationDidChangeNotification() {
|
||||
base::saturated_cast<int>([[UIDevice currentDevice] orientation]);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace crashpad
|
||||
|
Loading…
x
Reference in New Issue
Block a user