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

Side by Side Diff: third_party/crashpad/crashpad/snapshot/win/module_snapshot_win.h

Issue 1505213004: Copy Crashpad into the Chrome tree instead of importing it via DEPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 5 years 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
OLDNEW
(Empty)
1 // Copyright 2015 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_WIN_MODULE_SNAPSHOT_WIN_H_
16 #define CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_
17
18 #include <stdint.h>
19 #include <sys/types.h>
20 #include <windows.h>
21
22 #include <map>
23 #include <string>
24 #include <vector>
25
26 #include "base/basictypes.h"
27 #include "base/memory/scoped_ptr.h"
28 #include "snapshot/crashpad_info_client_options.h"
29 #include "snapshot/module_snapshot.h"
30 #include "snapshot/win/process_reader_win.h"
31 #include "util/misc/initialization_state.h"
32 #include "util/misc/initialization_state_dcheck.h"
33 #include "util/win/process_info.h"
34
35 namespace crashpad {
36
37 class PEImageReader;
38 struct UUID;
39
40 namespace internal {
41
42 //! \brief A ModuleSnapshot of a code module (binary image) loaded into a
43 //! running (or crashed) process on a Windows system.
44 class ModuleSnapshotWin final : public ModuleSnapshot {
45 public:
46 ModuleSnapshotWin();
47 ~ModuleSnapshotWin() override;
48
49 //! \brief Initializes the object.
50 //!
51 //! \param[in] process_reader A ProcessReader for the task containing the
52 //! module.
53 //! \param[in] process_reader_module The module within the ProcessReader for
54 //! which the snapshot should be created.
55 //!
56 //! \return `true` if the snapshot could be created, `false` otherwise with
57 //! an appropriate message logged.
58 bool Initialize(ProcessReaderWin* process_reader,
59 const ProcessInfo::Module& process_reader_module);
60
61 //! \brief Returns options from the module's CrashpadInfo structure.
62 //!
63 //! \param[out] options Options set in the module's CrashpadInfo structure.
64 void GetCrashpadOptions(CrashpadInfoClientOptions* options);
65
66 //! \brief Returns the PEImageReader used to read this module. Only valid
67 //! after Initialize() is called.
68 const PEImageReader& pe_image_reader() const { return *pe_image_reader_; }
69
70 // ModuleSnapshot:
71
72 std::string Name() const override;
73 uint64_t Address() const override;
74 uint64_t Size() const override;
75 time_t Timestamp() const override;
76 void FileVersion(uint16_t* version_0,
77 uint16_t* version_1,
78 uint16_t* version_2,
79 uint16_t* version_3) const override;
80 void SourceVersion(uint16_t* version_0,
81 uint16_t* version_1,
82 uint16_t* version_2,
83 uint16_t* version_3) const override;
84 ModuleType GetModuleType() const override;
85 void UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const override;
86 std::string DebugFileName() const override;
87 std::vector<std::string> AnnotationsVector() const override;
88 std::map<std::string, std::string> AnnotationsSimpleMap() const override;
89
90 private:
91 template <class Traits>
92 void GetCrashpadOptionsInternal(CrashpadInfoClientOptions* options);
93
94 // Initializes vs_fixed_file_info_ if it has not yet been initialized, and
95 // returns a pointer to it. Returns nullptr on failure, with a message logged
96 // on the first call.
97 const VS_FIXEDFILEINFO* VSFixedFileInfo() const;
98
99 std::wstring name_;
100 std::string pdb_name_;
101 UUID uuid_;
102 scoped_ptr<PEImageReader> pe_image_reader_;
103 ProcessReaderWin* process_reader_; // weak
104 time_t timestamp_;
105 uint32_t age_;
106 InitializationStateDcheck initialized_;
107
108 // VSFixedFileInfo() is logically const, but updates these members on the
109 // the call. See https://crashpad.chromium.org/bug/9.
110 mutable VS_FIXEDFILEINFO vs_fixed_file_info_;
111 mutable InitializationState initialized_vs_fixed_file_info_;
112
113 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotWin);
114 };
115
116 } // namespace internal
117 } // namespace crashpad
118
119 #endif // CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698