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

Unified Diff: chrome/install_static/install_util.cc

Issue 2507263002: Make nt_registry Create/OpenRegKey return a scoped object
Patch Set: fixes Created 3 years, 10 months 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') | no next file with comments »
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 633e8e0ac73ebb5797f91180cd84c895acd6c2d2..bdfe518515372595c82bb57ccf9b513103f4c5c6 100644
--- a/chrome/install_static/install_util.cc
+++ b/chrome/install_static/install_util.cc
@@ -350,16 +350,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::ScopedHANDLE key = nt::CreateRegKey(nt::HKCU, registry_path.c_str(),
+ KEY_SET_VALUE | KEY_WOW64_32KEY);
+ if (!key.is_valid())
grt (UTC plus 2) 2017/02/08 21:44:02 wdyt of an explicit operator bool so this can be w
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,
grt (UTC plus 2) 2017/02/08 21:44:02 i think that return key.SetRegValueDWORD(...); i
+ in_sample ? 1 : 0);
}
// Appends "[kCompanyPathName\]kProductPathName[install_suffix]" to |path|,
« no previous file with comments | « no previous file | chrome_elf/blacklist/blacklist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698