Commit 14e3154d authored by avi@chromium.org's avatar avi@chromium.org

Fix leak in Mac PowerSaveBlocker.

BUG=none
TEST=none


Review URL: https://chromiumcodereview.appspot.com/10832392

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152440 0039d316-1c4b-4281-b951-d872f2087c98
parent fc475649
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h" #include "base/sys_string_conversions.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
...@@ -74,8 +75,12 @@ void PowerSaveBlocker::Delegate::ApplyBlock() { ...@@ -74,8 +75,12 @@ void PowerSaveBlocker::Delegate::ApplyBlock() {
break; break;
} }
if (level) { if (level) {
IOReturn result = IOPMAssertionCreateWithName(level, kIOPMAssertionLevelOn, base::mac::ScopedCFTypeRef<CFStringRef> cf_reason(
base::SysUTF8ToCFStringRef(reason_), &assertion_); base::SysUTF8ToCFStringRef(reason_));
IOReturn result = IOPMAssertionCreateWithName(level,
kIOPMAssertionLevelOn,
cf_reason,
&assertion_);
LOG_IF(ERROR, result != kIOReturnSuccess) LOG_IF(ERROR, result != kIOReturnSuccess)
<< "IOPMAssertionCreate: " << result; << "IOPMAssertionCreate: " << result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment