summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-03 07:29:56 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-03 07:29:56 +0000
commit76602ffe79164dfcc39b001e15d9950418bb7998 (patch)
treeadf004a007a8793f3d74f135a84ec8a4d653e3eb /base
parentfae2fb0a99eec92ee3d1024b181c47fda265bdb5 (diff)
downloadchromium_src-76602ffe79164dfcc39b001e15d9950418bb7998.zip
chromium_src-76602ffe79164dfcc39b001e15d9950418bb7998.tar.gz
chromium_src-76602ffe79164dfcc39b001e15d9950418bb7998.tar.bz2
Replace all PROPVARIANTs by base::win::ScopedPropVariant across the entire codebase.
Follow-up to crrev.com/177951. Fixes a memory leak in ie_importer.cc. BUG=None Review URL: https://chromiumcodereview.appspot.com/12092077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/win/win_util.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 875dbad..4c8efb9 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -18,29 +18,27 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "base/win/registry.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
+#include "base/win/registry.h"
#include "base/win/scoped_co_mem.h"
#include "base/win/scoped_handle.h"
+#include "base/win/scoped_propvariant.h"
#include "base/win/windows_version.h"
namespace {
// Sets the value of |property_key| to |property_value| in |property_store|.
-// Clears the PropVariant contained in |property_value|.
bool SetPropVariantValueForPropertyStore(
IPropertyStore* property_store,
const PROPERTYKEY& property_key,
- PROPVARIANT* property_value) {
+ const base::win::ScopedPropVariant& property_value) {
DCHECK(property_store);
- HRESULT result = property_store->SetValue(property_key, *property_value);
+ HRESULT result = property_store->SetValue(property_key, property_value.get());
if (result == S_OK)
result = property_store->Commit();
-
- PropVariantClear(property_value);
return SUCCEEDED(result);
}
@@ -136,25 +134,29 @@ bool UserAccountControlIsEnabled() {
bool SetBooleanValueForPropertyStore(IPropertyStore* property_store,
const PROPERTYKEY& property_key,
bool property_bool_value) {
- PROPVARIANT property_value;
- if (FAILED(InitPropVariantFromBoolean(property_bool_value, &property_value)))
+ ScopedPropVariant property_value;
+ if (FAILED(InitPropVariantFromBoolean(property_bool_value,
+ property_value.Receive()))) {
return false;
+ }
return SetPropVariantValueForPropertyStore(property_store,
property_key,
- &property_value);
+ property_value);
}
bool SetStringValueForPropertyStore(IPropertyStore* property_store,
const PROPERTYKEY& property_key,
const wchar_t* property_string_value) {
- PROPVARIANT property_value;
- if (FAILED(InitPropVariantFromString(property_string_value, &property_value)))
+ ScopedPropVariant property_value;
+ if (FAILED(InitPropVariantFromString(property_string_value,
+ property_value.Receive()))) {
return false;
+ }
return SetPropVariantValueForPropertyStore(property_store,
property_key,
- &property_value);
+ property_value);
}
bool SetAppIdForPropertyStore(IPropertyStore* property_store,