Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: snapshot/win/system_snapshot_win.h

Issue 936333004: win: Add implementation of system_snapshot for Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@add-time-win
Patch Set: fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/system_snapshot_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with 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 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #ifndef CRASHPAD_SNAPSHOT_MAC_SYSTEM_SNAPSHOT_MAC_H_ 15 #ifndef CRASHPAD_SNAPSHOT_WIN_SYSTEM_SNAPSHOT_WIN_H_
16 #define CRASHPAD_SNAPSHOT_MAC_SYSTEM_SNAPSHOT_MAC_H_ 16 #define CRASHPAD_SNAPSHOT_WIN_SYSTEM_SNAPSHOT_WIN_H_
17 17
18 #include <stdint.h> 18 #include <stdint.h>
19 #include <sys/time.h>
19 20
20 #include <string> 21 #include <string>
21 22
22 #include "base/basictypes.h" 23 #include "base/basictypes.h"
23 #include "snapshot/system_snapshot.h" 24 #include "snapshot/system_snapshot.h"
25 #include "snapshot/win/process_reader_win.h"
24 #include "util/misc/initialization_state_dcheck.h" 26 #include "util/misc/initialization_state_dcheck.h"
25 27
26 namespace crashpad { 28 namespace crashpad {
27 29
28 class ProcessReader; 30 class ProcessReaderWin;
29 31
30 namespace internal { 32 namespace internal {
31 33
32 //! \brief A SystemSnapshot of the running system, when the system runs Mac OS 34 //! \brief A SystemSnapshot of the running system, when the system runs Windows.
33 //! X. 35 class SystemSnapshotWin final : public SystemSnapshot {
34 class SystemSnapshotMac final : public SystemSnapshot {
35 public: 36 public:
36 SystemSnapshotMac(); 37 SystemSnapshotWin();
37 ~SystemSnapshotMac() override; 38 ~SystemSnapshotWin() override;
38 39
39 //! \brief Initializes the object. 40 //! \brief Initializes the object.
40 //! 41 //!
41 //! \param[in] process_reader A reader for the process being snapshotted. 42 //! \param[in] process_reader A reader for the process being snapshotted.
42 //! \n\n 43 //!
43 //! It seems odd that a system snapshot implementation would need a 44 //! It seems odd that a system snapshot implementation would need a
44 //! ProcessReader, but some of the information reported about the system 45 //! ProcessReaderWin, but some of the information reported about the
45 //! depends on the process its being reported for. For example, the 46 //! system depends on the process it's being reported for. For example,
46 //! architecture returned by GetCPUArchitecture() should be the 47 //! the architecture returned by GetCPUArchitecture() should be the
47 //! architecture of the process, which may be different than the native 48 //! 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 //! architecture of the system: an x86_64 system can run both x86_64 and
49 //! 32-bit x86 processes. 50 //! 32-bit x86 processes.
50 //! \param[in] snapshot_time The time of the snapshot being taken. 51 void Initialize(ProcessReaderWin* process_reader);
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 52
59 // SystemSnapshot: 53 // SystemSnapshot:
60 54
61 CPUArchitecture GetCPUArchitecture() const override; 55 CPUArchitecture GetCPUArchitecture() const override;
62 uint32_t CPURevision() const override; 56 uint32_t CPURevision() const override;
63 uint8_t CPUCount() const override; 57 uint8_t CPUCount() const override;
64 std::string CPUVendor() const override; 58 std::string CPUVendor() const override;
65 void CPUFrequency(uint64_t* current_hz, uint64_t* max_hz) const override; 59 void CPUFrequency(uint64_t* current_hz, uint64_t* max_hz) const override;
66 uint32_t CPUX86Signature() const override; 60 uint32_t CPUX86Signature() const override;
67 uint64_t CPUX86Features() const override; 61 uint64_t CPUX86Features() const override;
68 uint64_t CPUX86ExtendedFeatures() const override; 62 uint64_t CPUX86ExtendedFeatures() const override;
69 uint32_t CPUX86Leaf7Features() const override; 63 uint32_t CPUX86Leaf7Features() const override;
70 bool CPUX86SupportsDAZ() const override; 64 bool CPUX86SupportsDAZ() const override;
71 OperatingSystem GetOperatingSystem() const override; 65 OperatingSystem GetOperatingSystem() const override;
72 bool OSServer() const override; 66 bool OSServer() const override;
73 void OSVersion( 67 void OSVersion(int* major,
74 int* major, int* minor, int* bugfix, std::string* build) const override; 68 int* minor,
69 int* bugfix,
70 std::string* build) const override;
75 std::string OSVersionFull() const override; 71 std::string OSVersionFull() const override;
76 bool NXEnabled() const override; 72 bool NXEnabled() const override;
77 std::string MachineDescription() const override; 73 std::string MachineDescription() const override;
78 void TimeZone(DaylightSavingTimeStatus* dst_status, 74 void TimeZone(DaylightSavingTimeStatus* dst_status,
79 int* standard_offset_seconds, 75 int* standard_offset_seconds,
80 int* daylight_offset_seconds, 76 int* daylight_offset_seconds,
81 std::string* standard_name, 77 std::string* standard_name,
82 std::string* daylight_name) const override; 78 std::string* daylight_name) const override;
83 79
84 private: 80 private:
85 std::string os_version_full_; 81 std::string os_version_full_;
86 std::string os_version_build_; 82 std::string os_version_build_;
87 ProcessReader* process_reader_; // weak 83 ProcessReaderWin* process_reader_; // weak
88 const timeval* snapshot_time_; // weak
89 int os_version_major_; 84 int os_version_major_;
90 int os_version_minor_; 85 int os_version_minor_;
91 int os_version_bugfix_; 86 int os_version_bugfix_;
92 bool os_server_; 87 bool os_server_;
93 InitializationStateDcheck initialized_; 88 InitializationStateDcheck initialized_;
94 89
95 DISALLOW_COPY_AND_ASSIGN(SystemSnapshotMac); 90 DISALLOW_COPY_AND_ASSIGN(SystemSnapshotWin);
96 }; 91 };
97 92
98 } // namespace internal 93 } // namespace internal
99 } // namespace crashpad 94 } // namespace crashpad
100 95
101 #endif // CRASHPAD_SNAPSHOT_MAC_SYSTEM_SNAPSHOT_MAC_H_ 96 #endif // CRASHPAD_SNAPSHOT_WIN_SYSTEM_SNAPSHOT_WIN_H_
OLDNEW
« no previous file with comments | « snapshot/win/process_reader_win.cc ('k') | snapshot/win/system_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698