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

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

Issue 1472963002: win: Only call GetFileVersionInfo() once per module (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: 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
« no previous file with comments | « no previous file | snapshot/win/module_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 2015 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_WIN_MODULE_SNAPSHOT_WIN_H_ 15 #ifndef CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_
16 #define CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_ 16 #define CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_
17 17
18 #include <stdint.h> 18 #include <stdint.h>
19 #include <sys/types.h> 19 #include <sys/types.h>
20 #include <windows.h>
20 21
21 #include <map> 22 #include <map>
22 #include <string> 23 #include <string>
23 #include <vector> 24 #include <vector>
24 25
25 #include "base/basictypes.h" 26 #include "base/basictypes.h"
26 #include "base/memory/scoped_ptr.h" 27 #include "base/memory/scoped_ptr.h"
27 #include "snapshot/crashpad_info_client_options.h" 28 #include "snapshot/crashpad_info_client_options.h"
28 #include "snapshot/module_snapshot.h" 29 #include "snapshot/module_snapshot.h"
29 #include "snapshot/win/process_reader_win.h" 30 #include "snapshot/win/process_reader_win.h"
31 #include "util/misc/initialization_state.h"
30 #include "util/misc/initialization_state_dcheck.h" 32 #include "util/misc/initialization_state_dcheck.h"
31 #include "util/win/process_info.h" 33 #include "util/win/process_info.h"
32 34
33 namespace crashpad { 35 namespace crashpad {
34 36
35 class PEImageReader; 37 class PEImageReader;
36 struct UUID; 38 struct UUID;
37 39
38 namespace internal { 40 namespace internal {
39 41
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ModuleType GetModuleType() const override; 84 ModuleType GetModuleType() const override;
83 void UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const override; 85 void UUIDAndAge(crashpad::UUID* uuid, uint32_t* age) const override;
84 std::string DebugFileName() const override; 86 std::string DebugFileName() const override;
85 std::vector<std::string> AnnotationsVector() const override; 87 std::vector<std::string> AnnotationsVector() const override;
86 std::map<std::string, std::string> AnnotationsSimpleMap() const override; 88 std::map<std::string, std::string> AnnotationsSimpleMap() const override;
87 89
88 private: 90 private:
89 template <class Traits> 91 template <class Traits>
90 void GetCrashpadOptionsInternal(CrashpadInfoClientOptions* options); 92 void GetCrashpadOptionsInternal(CrashpadInfoClientOptions* options);
91 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
92 std::wstring name_; 99 std::wstring name_;
93 std::string pdb_name_; 100 std::string pdb_name_;
94 UUID uuid_; 101 UUID uuid_;
95 scoped_ptr<PEImageReader> pe_image_reader_; 102 scoped_ptr<PEImageReader> pe_image_reader_;
96 ProcessReaderWin* process_reader_; // weak 103 ProcessReaderWin* process_reader_; // weak
97 time_t timestamp_; 104 time_t timestamp_;
98 uint32_t age_; 105 uint32_t age_;
99 InitializationStateDcheck initialized_; 106 InitializationStateDcheck initialized_;
100 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
101 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotWin); 113 DISALLOW_COPY_AND_ASSIGN(ModuleSnapshotWin);
102 }; 114 };
103 115
104 } // namespace internal 116 } // namespace internal
105 } // namespace crashpad 117 } // namespace crashpad
106 118
107 #endif // CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_ 119 #endif // CRASHPAD_SNAPSHOT_WIN_MODULE_SNAPSHOT_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | snapshot/win/module_snapshot_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698