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. |
| 4 |
| 5 #include "chrome/common/terminate_on_heap_corruption_experiment_win.h" |
| 6 |
| 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/win/registry.h" |
| 9 #include "chrome/common/chrome_constants.h" |
| 10 #include "chrome/common/chrome_version_info.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 wchar_t* GetBeaconKeyPath() { |
| 15 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 16 if (channel == chrome::VersionInfo::CHANNEL_CANARY) { |
| 17 return L"SOFTWARE\\" PRODUCT_STRING_PATH |
| 18 L"\\DisableTerminateOnProcessHeapCorruptionSxs"; |
| 19 } |
| 20 return L"SOFTWARE\\" PRODUCT_STRING_PATH |
| 21 L"\\DisableTerminateOnProcessHeapCorruption"; |
| 22 } |
| 23 |
| 24 } // namespace |
| 25 |
| 26 bool ShouldExperimentallyDisableTerminateOnHeapCorruption() { |
| 27 base::win::RegKey regkey( |
| 28 HKEY_CURRENT_USER, GetBeaconKeyPath(), KEY_QUERY_VALUE); |
| 29 return regkey.Valid(); |
| 30 } |
| 31 |
| 32 void InitializeDisableTerminateOnHeapCorruptionExperiment() { |
| 33 base::win::RegKey regkey(HKEY_CURRENT_USER); |
| 34 |
| 35 if (base::FieldTrialList::FindFullName("TerminateOnProcessHeapCorruption") == |
| 36 "Disabled") { |
| 37 regkey.CreateKey(GetBeaconKeyPath()); |
| 38 } else { |
| 39 regkey.DeleteKey(GetBeaconKeyPath()); |
| 40 } |
| 41 } |
OLD | NEW |