| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 | |
| 15 #ifndef CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ | |
| 16 #define CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ | |
| 17 | |
| 18 #include <stdint.h> | |
| 19 | |
| 20 #include <string> | |
| 21 | |
| 22 #include "base/basictypes.h" | |
| 23 #include "snapshot/system_snapshot.h" | |
| 24 #include "util/misc/initialization_state_dcheck.h" | |
| 25 | |
| 26 namespace crashpad { | |
| 27 | |
| 28 class ProcessReader; | |
| 29 | |
| 30 namespace internal { | |
| 31 | |
| 32 //! \brief A SystemSnapshot of the running system, when the system runs Mac OS | |
| 33 //! X. | |
| 34 class SystemSnapshotMac final : public SystemSnapshot { | |
| 35 public: | |
| 36 SystemSnapshotMac(); | |
| 37 ~SystemSnapshotMac(); | |
| 38 | |
| 39 //! \brief Initializes the object. | |
| 40 //! | |
| 41 //! \param[in] process_reader A reader for the process being snapshotted. | |
| 42 //! \n\n | |
| 43 //! It seems odd that a system snapshot implementation would need a | |
| 44 //! ProcessReader, but some of the information reported about the system | |
| 45 //! depends on the process it’s being reported for. For example, the | |
| 46 //! architecture returned by GetCPUArchitecture() should be the | |
| 47 //! architecture of the process, which may be different than the native | |
| 48 //! architecture of the system: an x86_64 system can run both x86_64 and | |
| 49 //! 32-bit x86 processes. | |
| 50 //! \param[in] snapshot_time The time of the snapshot being taken. | |
| 51 //! \n\n | |
| 52 //! This parameter is necessary for TimeZone() to determine whether | |
| 53 //! daylight saving time was in effect at the time the snapshot was taken. | |
| 54 //! Otherwise, it would need to base its determination on the current | |
| 55 //! time, which may be different than the snapshot time for snapshots | |
| 56 //! generated around the daylight saving transition time. | |
| 57 void Initialize(ProcessReader* process_reader, const timeval* snapshot_time); | |
| 58 | |
| 59 // SystemSnapshot: | |
| 60 | |
| 61 CPUArchitecture GetCPUArchitecture() const override; | |
| 62 uint32_t CPURevision() const override; | |
| 63 uint8_t CPUCount() const override; | |
| 64 std::string CPUVendor() const override; | |
| 65 void CPUFrequency(uint64_t* current_hz, uint64_t* max_hz) const override; | |
| 66 uint32_t CPUX86Signature() const override; | |
| 67 uint64_t CPUX86Features() const override; | |
| 68 uint64_t CPUX86ExtendedFeatures() const override; | |
| 69 uint32_t CPUX86Leaf7Features() const override; | |
| 70 bool CPUX86SupportsDAZ() const override; | |
| 71 OperatingSystem GetOperatingSystem() const override; | |
| 72 bool OSServer() const override; | |
| 73 void OSVersion( | |
| 74 int* major, int* minor, int* bugfix, std::string* build) const override; | |
| 75 std::string OSVersionFull() const override; | |
| 76 bool NXEnabled() const override; | |
| 77 std::string MachineDescription() const override; | |
| 78 void TimeZone(DaylightSavingTimeStatus* dst_status, | |
| 79 int* standard_offset_seconds, | |
| 80 int* daylight_offset_seconds, | |
| 81 std::string* standard_name, | |
| 82 std::string* daylight_name) const override; | |
| 83 | |
| 84 private: | |
| 85 std::string os_version_full_; | |
| 86 std::string os_version_build_; | |
| 87 ProcessReader* process_reader_; // weak | |
| 88 const timeval* snapshot_time_; // weak | |
| 89 int os_version_major_; | |
| 90 int os_version_minor_; | |
| 91 int os_version_bugfix_; | |
| 92 bool os_server_; | |
| 93 InitializationStateDcheck initialized_; | |
| 94 | |
| 95 DISALLOW_COPY_AND_ASSIGN(SystemSnapshotMac); | |
| 96 }; | |
| 97 | |
| 98 } // namespace internal | |
| 99 } // namespace crashpad | |
| 100 | |
| 101 #endif // CRASHPAD_SNAPSHOT_SYSTEM_SNAPSHOT_MAC_H_ | |
| OLD | NEW |