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

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

Issue 2012853003: Reland of Pass SequencedTaskRunner to PowerSaveBlocker for ui/file ops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SingleThreadTaskRunner for _x11 Created 4 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 unified diff | Download patch
« no previous file with comments | « content/browser/power_save_blocker_impl.cc ('k') | content/browser/power_save_blocker_ozone.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) 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 "content/browser/power_save_blocker_impl.h" 5 #include "content/browser/power_save_blocker_impl.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"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DCHECK_EQ(base::PlatformThread::CurrentId(), 90 DCHECK_EQ(base::PlatformThread::CurrentId(),
91 g_power_thread.Pointer()->GetThreadId()); 91 g_power_thread.Pointer()->GetThreadId());
92 92
93 if (assertion_ != kIOPMNullAssertionID) { 93 if (assertion_ != kIOPMNullAssertionID) {
94 IOReturn result = IOPMAssertionRelease(assertion_); 94 IOReturn result = IOPMAssertionRelease(assertion_);
95 LOG_IF(ERROR, result != kIOReturnSuccess) 95 LOG_IF(ERROR, result != kIOReturnSuccess)
96 << "IOPMAssertionRelease: " << result; 96 << "IOPMAssertionRelease: " << result;
97 } 97 }
98 } 98 }
99 99
100 PowerSaveBlockerImpl::PowerSaveBlockerImpl(PowerSaveBlockerType type, 100 PowerSaveBlockerImpl::PowerSaveBlockerImpl(
101 Reason reason, 101 PowerSaveBlockerType type,
102 const std::string& description) 102 Reason reason,
103 : delegate_(new Delegate(type, description)) { 103 const std::string& description,
104 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
105 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner)
106 : delegate_(new Delegate(type, description)),
107 ui_task_runner_(ui_task_runner),
108 blocking_task_runner_(blocking_task_runner) {
104 g_power_thread.Pointer()->message_loop()->PostTask( 109 g_power_thread.Pointer()->message_loop()->PostTask(
105 FROM_HERE, 110 FROM_HERE,
106 base::Bind(&Delegate::ApplyBlock, delegate_)); 111 base::Bind(&Delegate::ApplyBlock, delegate_));
107 } 112 }
108 113
109 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() { 114 PowerSaveBlockerImpl::~PowerSaveBlockerImpl() {
110 g_power_thread.Pointer()->message_loop()->PostTask( 115 g_power_thread.Pointer()->message_loop()->PostTask(
111 FROM_HERE, 116 FROM_HERE,
112 base::Bind(&Delegate::RemoveBlock, delegate_)); 117 base::Bind(&Delegate::RemoveBlock, delegate_));
113 } 118 }
114 119
115 } // namespace content 120 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/power_save_blocker_impl.cc ('k') | content/browser/power_save_blocker_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698