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

Unified Diff: base/mac/mac_util.mm

Issue 15848005: Cleanup: Remove ScopedGenericObj. Use scoped_ptr<type, CustomDeleter> instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 | base/memory/scoped_generic_obj.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/mac_util.mm
===================================================================
--- base/mac/mac_util.mm (revision 202209)
+++ base/mac/mac_util.mm (working copy)
@@ -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,22 @@
}
#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")));
+ std::string return_string;
+ ScopedIOObject<io_service_t> platform_expert(
+ IOServiceGetMatchingService(kIOMasterPortDefault,
+ IOServiceMatching("IOPlatformExpertDevice")));
if (!platform_expert)
- return "";
+ return return_string;
Mark Mentovai 2013/05/28 20:52:18 Since you’ve rewritten this function to always ret
Lei Zhang 2013/05/28 21:01:18 Done.
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));
+ if (model_data)
+ return_string = reinterpret_cast<const char*>(CFDataGetBytePtr(model_data));
+ return return_string;
}
bool ParseModelIdentifier(const std::string& ident,
« no previous file with comments | « no previous file | base/memory/scoped_generic_obj.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698