OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
Robert Sesek
2014/06/10 21:14:14
nit: blank line after
Sigurður Ásgeirsson
2014/06/11 13:19:39
Done.
| |
4 #include <map> | |
5 #include <vector> | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/synchronization/lock.h" | |
9 #include "breakpad/src/client/windows/handler/exception_handler.h" | |
10 | |
11 namespace breakpad { | |
12 | |
13 // Fwd. | |
Robert Sesek
2014/06/10 21:14:14
Delete line.
Sigurður Ásgeirsson
2014/06/11 13:19:39
Done.
| |
14 class BreakpadClient; | |
15 | |
16 // Manages the breakpad key/value pair stash, there may only be one instance | |
17 // of this class per process at one time. | |
18 class CrashKeysWin { | |
19 public: | |
20 CrashKeysWin(); | |
21 ~CrashKeysWin(); | |
22 | |
23 // May only be called once. | |
24 // |exe_path| is the path to the executable running, which may be used | |
25 // to figure out whether this is a user or system install. | |
26 // |type| is the process type, or mode this process is running in e.g. | |
27 // something like "browser" or "renderer". | |
28 // |profile_type| is a string describing the kind of the user's Windows | |
29 // profile, e.g. "mandatory", or "roaming" or similar. | |
30 // |cmd_line| is the current process' command line consulted for explicit | |
31 // crash reporting flags. | |
32 // |breakpad_client| is consulted for crash reporting settings. | |
33 google_breakpad::CustomClientInfo* GetCustomInfo( | |
34 const std::wstring& exe_path, | |
35 const std::wstring& type, | |
36 const std::wstring& profile_type, | |
37 CommandLine* cmd_line, | |
38 BreakpadClient* breakpad_client); | |
39 | |
40 void SetCrashKeyValue(const std::wstring& key, const std::wstring& value); | |
41 void ClearCrashKeyValue(const std::wstring& key); | |
42 | |
43 static CrashKeysWin* keeper() { return keeper_; } | |
44 | |
45 private: | |
46 // One-time initialization of private key/value pairs. | |
47 void SetPluginPath(const std::wstring& path); | |
48 void SetBreakpadDumpPath(BreakpadClient* breakpad_client); | |
49 | |
50 // Must not be resized after GetCustomInfo is invoked. | |
51 std::vector<google_breakpad::CustomInfoEntry> custom_entries_; | |
52 | |
53 typedef std::map<std::wstring, google_breakpad::CustomInfoEntry*> | |
54 DynamicEntriesMap; | |
55 base::Lock lock_; | |
56 // Keeps track of the next index for a new dynamic entry. | |
57 size_t dynamic_keys_offset_; // Under lock_. | |
58 // Maintains key->entry information for dynamic key/value entries | |
59 // in custom_entries_. | |
60 DynamicEntriesMap dynamic_entries_; // Under lock_. | |
61 | |
62 // Stores the sole instance of this class allowed per process. | |
63 static CrashKeysWin* keeper_; | |
64 }; | |
65 | |
66 } // namespace breakpad | |
OLD | NEW |