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

Unified Diff: chrome/install_static/install_util.cc

Issue 2507263002: Make nt_registry Create/OpenRegKey return a scoped object
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome_elf/blacklist/blacklist.cc » ('j') | chrome_elf/nt_registry/nt_registry.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/install_static/install_util.cc
diff --git a/chrome/install_static/install_util.cc b/chrome/install_static/install_util.cc
index edec76d2e567b011248c619f0f601cedeb09bc7a..fae64aa1b8b15b4eb9ba22fae747c0df60ca5e1f 100644
--- a/chrome/install_static/install_util.cc
+++ b/chrome/install_static/install_util.cc
@@ -412,16 +412,13 @@ bool GetCollectStatsInSample() {
bool SetCollectStatsInSample(bool in_sample) {
std::wstring registry_path = GetChromeInstallRegistryPath();
- HANDLE key_handle = INVALID_HANDLE_VALUE;
- if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(),
- KEY_SET_VALUE | KEY_WOW64_32KEY, &key_handle)) {
+ nt::ScopedRegKeyHANDLE key = nt::CreateRegKey(
+ nt::HKCU, registry_path.c_str(), KEY_SET_VALUE | KEY_WOW64_32KEY);
+ if (!key.is_valid())
return false;
- }
- bool success = nt::SetRegValueDWORD(key_handle, kRegValueChromeStatsSample,
- in_sample ? 1 : 0);
- nt::CloseRegKey(key_handle);
- return success;
+ return nt::SetRegValueDWORD(key.get(), kRegValueChromeStatsSample,
+ in_sample ? 1 : 0);
}
bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled) {
« no previous file with comments | « no previous file | chrome_elf/blacklist/blacklist.cc » ('j') | chrome_elf/nt_registry/nt_registry.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698