summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 08:51:51 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 08:51:51 +0000
commit8310b8691f2c07c6a1b7c8cad8925343e42ef12e (patch)
treeee99b5efff556b77d76707ce3ec7b672198dfd76 /base/mac
parent96f03c488a2cb0cd52e7d5ef1d109e7ed6b387f1 (diff)
downloadchromium_src-8310b8691f2c07c6a1b7c8cad8925343e42ef12e.zip
chromium_src-8310b8691f2c07c6a1b7c8cad8925343e42ef12e.tar.gz
chromium_src-8310b8691f2c07c6a1b7c8cad8925343e42ef12e.tar.bz2
Cleanup: Remove ScopedGenericObj. Use scoped_ptr<type, CustomDeleter> instead.
Review URL: https://chromiumcodereview.appspot.com/15848005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/mac_util.mm46
1 files changed, 18 insertions, 28 deletions
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index f758b52..32dc735 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -18,7 +18,7 @@
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/memory/scoped_generic_obj.h"
+#include "base/mac/scoped_ioobject.h"
#include "base/memory/scoped_nsobject.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@@ -647,34 +647,24 @@ bool IsOSLaterThanMountainLion_DontCallThis() {
}
#endif
-namespace {
-
-// ScopedGenericObj functor for IOObjectRelease().
-class ScopedReleaseIOObject {
- public:
- void operator()(io_object_t x) const {
- IOObjectRelease(x);
- }
-};
-
-} // namespace
-
std::string GetModelIdentifier() {
- ScopedGenericObj<io_service_t, ScopedReleaseIOObject>
- platform_expert(IOServiceGetMatchingService(
- kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")));
- if (!platform_expert)
- return "";
- ScopedCFTypeRef<CFDataRef> model_data(
- static_cast<CFDataRef>(IORegistryEntryCreateCFProperty(
- platform_expert,
- CFSTR("model"),
- kCFAllocatorDefault,
- 0)));
- if (!model_data)
- return "";
- return reinterpret_cast<const char*>(
- CFDataGetBytePtr(model_data));
+ std::string return_string;
+ ScopedIOObject<io_service_t> platform_expert(
+ IOServiceGetMatchingService(kIOMasterPortDefault,
+ IOServiceMatching("IOPlatformExpertDevice")));
+ if (platform_expert) {
+ ScopedCFTypeRef<CFDataRef> model_data(
+ static_cast<CFDataRef>(IORegistryEntryCreateCFProperty(
+ platform_expert,
+ CFSTR("model"),
+ kCFAllocatorDefault,
+ 0)));
+ if (model_data) {
+ return_string =
+ reinterpret_cast<const char*>(CFDataGetBytePtr(model_data));
+ }
+ }
+ return return_string;
}
bool ParseModelIdentifier(const std::string& ident,