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

Side by Side Diff: device/power_save_blocker/power_save_blocker_mac.cc

Issue 2163023002: Unify usage of logging/assert macros in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix base/android/build_info.cc compile Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « chromecast/app/linux/cast_crash_reporter_client_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/power_save_blocker/power_save_blocker.h" 5 #include "device/power_save_blocker/power_save_blocker.h"
6 6
7 #include <IOKit/pwr_mgt/IOPMLib.h> 7 #include <IOKit/pwr_mgt/IOPMLib.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h"
11 #include "base/mac/scoped_cftyperef.h" 12 #include "base/mac/scoped_cftyperef.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
14 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 17
17 namespace device { 18 namespace device {
18 namespace { 19 namespace {
19 20
20 // Power management cannot be done on the UI thread. IOPMAssertionCreate does a 21 // Power management cannot be done on the UI thread. IOPMAssertionCreate does a
21 // synchronous MIG call to configd, so if it is called on the main thread the UI 22 // synchronous MIG call to configd, so if it is called on the main thread the UI
22 // is at the mercy of another process. See http://crbug.com/79559 and 23 // is at the mercy of another process. See http://crbug.com/79559 and
23 // http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.16.31/pwr_mgt. subproj/IOPMLibPrivate.c 24 // http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.16.31/pwr_mgt. subproj/IOPMLibPrivate.c
24 // . 25 // .
25 struct PowerSaveBlockerLazyInstanceTraits { 26 struct PowerSaveBlockerLazyInstanceTraits {
26 static const bool kRegisterOnExit = false; 27 static const bool kRegisterOnExit = false;
27 #ifndef NDEBUG 28 #if DCHECK_IS_ON()
28 static const bool kAllowedToAccessOnNonjoinableThread = true; 29 static const bool kAllowedToAccessOnNonjoinableThread = true;
29 #endif 30 #endif
30 31
31 static base::Thread* New(void* instance) { 32 static base::Thread* New(void* instance) {
32 base::Thread* thread = new (instance) base::Thread("PowerSaveBlocker"); 33 base::Thread* thread = new (instance) base::Thread("PowerSaveBlocker");
33 thread->Start(); 34 thread->Start();
34 return thread; 35 return thread;
35 } 36 }
36 static void Delete(base::Thread* instance) {} 37 static void Delete(base::Thread* instance) {}
37 }; 38 };
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 g_power_thread.Pointer()->task_runner()->PostTask( 112 g_power_thread.Pointer()->task_runner()->PostTask(
112 FROM_HERE, base::Bind(&Delegate::ApplyBlock, delegate_)); 113 FROM_HERE, base::Bind(&Delegate::ApplyBlock, delegate_));
113 } 114 }
114 115
115 PowerSaveBlocker::~PowerSaveBlocker() { 116 PowerSaveBlocker::~PowerSaveBlocker() {
116 g_power_thread.Pointer()->task_runner()->PostTask( 117 g_power_thread.Pointer()->task_runner()->PostTask(
117 FROM_HERE, base::Bind(&Delegate::RemoveBlock, delegate_)); 118 FROM_HERE, base::Bind(&Delegate::RemoveBlock, delegate_));
118 } 119 }
119 120
120 } // namespace device 121 } // namespace device
OLDNEW
« no previous file with comments | « chromecast/app/linux/cast_crash_reporter_client_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698