Make ScopedGeneric uses slightly more consistent

R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/1426533008 .
This commit is contained in:
Mark Mentovai 2015-11-09 15:33:36 -05:00
parent ff274507dc
commit 81ece89d6a
5 changed files with 10 additions and 7 deletions

View File

@ -24,11 +24,6 @@ namespace crashpad {
namespace internal {
// static
FileHandle ScopedLockedFileHandleTraits::InvalidValue() {
return kInvalidFileHandle;
}
// static
void ScopedLockedFileHandleTraits::Free(FileHandle handle) {
if (handle != kInvalidFileHandle) {

View File

@ -31,7 +31,7 @@ namespace crashpad {
namespace internal {
struct ScopedLockedFileHandleTraits {
static FileHandle InvalidValue();
static FileHandle InvalidValue() { return kInvalidFileHandle; }
static void Free(FileHandle handle);
};

View File

@ -525,6 +525,7 @@ struct ScopedRegistryKeyCloseTraits {
RegCloseKey(key);
}
};
using ScopedRegistryKey =
base::ScopedGeneric<HKEY, ScopedRegistryKeyCloseTraits>;

View File

@ -17,10 +17,12 @@
#include "base/logging.h"
namespace crashpad {
namespace internal {
// static
void LocalAllocTraits::Free(HLOCAL memory) {
PLOG_IF(ERROR, LocalFree(memory) != nullptr) << "LocalFree";
}
} // namespace internal
} // namespace crashpad

View File

@ -21,12 +21,17 @@
namespace crashpad {
namespace internal {
struct LocalAllocTraits {
static HLOCAL InvalidValue() { return nullptr; }
static void Free(HLOCAL mem);
};
using ScopedLocalAlloc = base::ScopedGeneric<HLOCAL, LocalAllocTraits>;
} // namespace internal
using ScopedLocalAlloc =
base::ScopedGeneric<HLOCAL, internal::LocalAllocTraits>;
} // namespace crashpad