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

Side by Side Diff: content/browser/power_save_blocker_mac.cc

Issue 8340028: Salient parts of http://codereview.chromium.org/8392042/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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 | « content/browser/power_save_blocker_common.cc ('k') | content/browser/power_save_blocker_win.cc » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/browser/power_save_blocker.h" 5 #include "content/browser/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/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "content/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace { 14 namespace {
15 15
16 // Power management cannot be done on the UI thread. IOPMAssertionCreate does a 16 // Power management cannot be done on the UI thread. IOPMAssertionCreate does a
17 // synchronous MIG call to configd, so if it is called on the main thread the UI 17 // synchronous MIG call to configd, so if it is called on the main thread the UI
18 // is at the mercy of another process. See http://crbug.com/79559 and 18 // is at the mercy of another process. See http://crbug.com/79559 and
19 // http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.16.31/pwr_mgt. subproj/IOPMLibPrivate.c . 19 // http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.16.31/pwr_mgt. subproj/IOPMLibPrivate.c .
20 base::Thread* g_power_thread; 20 base::Thread* g_power_thread;
21 IOPMAssertionID g_power_assertion; 21 IOPMAssertionID g_power_assertion;
22 22
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 if (!g_power_thread) { 63 if (!g_power_thread) {
64 g_power_assertion = kIOPMNullAssertionID; 64 g_power_assertion = kIOPMNullAssertionID;
65 g_power_thread = new base::Thread("PowerSaveBlocker"); 65 g_power_thread = new base::Thread("PowerSaveBlocker");
66 g_power_thread->Start(); 66 g_power_thread->Start();
67 } 67 }
68 68
69 g_power_thread->message_loop()-> 69 g_power_thread->message_loop()->
70 PostTask(FROM_HERE, base::Bind(CreateSleepAssertion, type)); 70 PostTask(FROM_HERE, base::Bind(CreateSleepAssertion, type));
71 } 71 }
OLDNEW
« no previous file with comments | « content/browser/power_save_blocker_common.cc ('k') | content/browser/power_save_blocker_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698