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 { namespace internal {
// static
FileHandle ScopedLockedFileHandleTraits::InvalidValue() {
return kInvalidFileHandle;
}
// static // static
void ScopedLockedFileHandleTraits::Free(FileHandle handle) { void ScopedLockedFileHandleTraits::Free(FileHandle handle) {
if (handle != kInvalidFileHandle) { if (handle != kInvalidFileHandle) {

View File

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

View File

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

View File

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

View File

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