Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ | 5 #ifndef COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ |
| 6 #define COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ | 6 #define COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | |
| 12 #include "base/debug/crash_logging.h" | |
| 11 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 12 | 14 |
| 15 namespace base { | |
| 16 class CommandLine; | |
| 17 } // namespace base | |
| 18 | |
| 13 namespace crash_keys { | 19 namespace crash_keys { |
| 14 | 20 |
| 15 // Sets the ID (which may either be a full GUID or a GUID that was already | 21 // Sets the ID (which may either be a full GUID or a GUID that was already |
| 16 // stripped from its dashes -- in either case this method will strip remaining | 22 // stripped from its dashes -- in either case this method will strip remaining |
| 17 // dashes before setting the crash key). | 23 // dashes before setting the crash key). |
| 18 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid); | 24 void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid); |
| 19 void ClearMetricsClientId(); | 25 void ClearMetricsClientId(); |
| 20 | 26 |
| 21 // Sets the list of active experiment/variations info. | 27 // Sets the list of active experiment/variations info. |
| 22 void SetVariationsList(const std::vector<std::string>& variations); | 28 void SetVariationsList(const std::vector<std::string>& variations); |
| 23 | 29 |
| 30 // Adds a common set of crash keys for holding command-line switches to |keys|. | |
| 31 void GetCrashKeysForCommandLineSwitches( | |
| 32 std::vector<base::debug::CrashKey>* keys); | |
| 33 | |
| 34 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. | |
| 35 void SetSwitchesFromCommandLine(const base::CommandLine& command_line); | |
|
grt (UTC plus 2)
2015/11/27 18:51:21
rather than overloading the function, i think it's
Joe Mason
2015/11/27 21:16:47
Done.
| |
| 36 | |
| 37 // Sets the kSwitch and kNumSwitches keys based on the given |command_line|. | |
| 38 // Ignore any switch for which |skip_filter| returns true. | |
| 39 void SetSwitchesFromCommandLine(const base::CommandLine& command_line, | |
| 40 const base::Callback<bool(const std::string &)>& skip_filter); | |
|
grt (UTC plus 2)
2015/11/27 18:51:21
callback seems like overkill. how about starting w
Joe Mason
2015/11/27 21:16:47
Done.
| |
| 41 | |
| 24 // Crash Key Constants ///////////////////////////////////////////////////////// | 42 // Crash Key Constants ///////////////////////////////////////////////////////// |
| 25 | 43 |
| 26 // kChunkMaxLength is the platform-specific maximum size that a value in a | 44 // kChunkMaxLength is the platform-specific maximum size that a value in a |
| 27 // single chunk can be; see base::debug::InitCrashKeys. The maximum lengths | 45 // single chunk can be; see base::debug::InitCrashKeys. The maximum lengths |
| 28 // specified by breakpad include the trailing NULL, so the actual length of the | 46 // specified by breakpad include the trailing NULL, so the actual length of the |
| 29 // chunk is one less. | 47 // chunk is one less. |
| 30 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 31 const size_t kChunkMaxLength = 255; | 49 const size_t kChunkMaxLength = 255; |
| 32 #else // OS_MACOSX | 50 #else // OS_MACOSX |
| 33 const size_t kChunkMaxLength = 63; | 51 const size_t kChunkMaxLength = 63; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 61 // The product release/distribution channel. | 79 // The product release/distribution channel. |
| 62 extern const char kChannel[]; | 80 extern const char kChannel[]; |
| 63 | 81 |
| 64 // The total number of experiments the instance has. | 82 // The total number of experiments the instance has. |
| 65 extern const char kNumVariations[]; | 83 extern const char kNumVariations[]; |
| 66 | 84 |
| 67 // The experiments chunk. Hashed experiment names separated by |,|. This is | 85 // The experiments chunk. Hashed experiment names separated by |,|. This is |
| 68 // typically set by SetExperimentList. | 86 // typically set by SetExperimentList. |
| 69 extern const char kVariations[]; | 87 extern const char kVariations[]; |
| 70 | 88 |
| 89 // Process command line switches. |kSwitch| should be formatted with an integer, | |
| 90 // in the range [1, kSwitchesMaxCount]. | |
| 91 const size_t kSwitchesMaxCount = 15; | |
| 92 extern const char kSwitch[]; | |
|
grt (UTC plus 2)
2015/11/27 18:51:21
may as well document this for what it is:
// A pri
Joe Mason
2015/11/27 21:16:47
Done.
| |
| 93 // The total number of switches, used to report the total in case more than | |
|
grt (UTC plus 2)
2015/11/27 18:51:21
nit: blank line before comment
Joe Mason
2015/11/27 21:16:47
Done.
| |
| 94 // |kSwitchesMaxCount| are present. | |
| 95 extern const char kNumSwitches[]; | |
| 96 | |
| 71 // Used to help investigate bug 464926. | 97 // Used to help investigate bug 464926. |
| 72 extern const char kBug464926CrashKey[]; | 98 extern const char kBug464926CrashKey[]; |
| 73 | 99 |
| 74 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
| 75 namespace mac { | 101 namespace mac { |
| 76 | 102 |
| 77 // Records Cocoa zombie/used-after-freed objects that resulted in a | 103 // Records Cocoa zombie/used-after-freed objects that resulted in a |
| 78 // deliberate crash. | 104 // deliberate crash. |
| 79 extern const char kZombie[]; | 105 extern const char kZombie[]; |
| 80 extern const char kZombieTrace[]; | 106 extern const char kZombieTrace[]; |
| 81 | 107 |
| 82 } // namespace mac | 108 } // namespace mac |
| 83 #endif | 109 #endif |
| 84 | 110 |
| 85 } // namespace crash_keys | 111 } // namespace crash_keys |
| 86 | 112 |
| 87 #endif // COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ | 113 #endif // COMPONENTS_CRASH_CORE_COMMON_CRASH_KEYS_H_ |
| OLD | NEW |