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

Side by Side Diff: chrome/browser/chromeos/power/freezer_cgroup_process_manager.cc

Issue 2133083002: Remove all remaining traces of MessageLoopProxy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/power/freezer_cgroup_process_manager.h" 5 #include "chrome/browser/chromeos/power/freezer_cgroup_process_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 14 matching lines...) Expand all
25 25
26 const char kFreezeCommand[] = "FROZEN"; 26 const char kFreezeCommand[] = "FROZEN";
27 const char kThawCommand[] = "THAWED"; 27 const char kThawCommand[] = "THAWED";
28 28
29 } // namespace 29 } // namespace
30 30
31 class FreezerCgroupProcessManager::FileWorker { 31 class FreezerCgroupProcessManager::FileWorker {
32 public: 32 public:
33 // Called on UI thread. 33 // Called on UI thread.
34 explicit FileWorker(scoped_refptr<base::SequencedTaskRunner> file_thread) 34 explicit FileWorker(scoped_refptr<base::SequencedTaskRunner> file_thread)
35 : ui_thread_(content::BrowserThread::GetMessageLoopProxyForThread( 35 : ui_thread_(content::BrowserThread::GetTaskRunnerForThread(
36 content::BrowserThread::UI)), 36 content::BrowserThread::UI)),
37 file_thread_(file_thread) { 37 file_thread_(file_thread) {
38 DCHECK(ui_thread_->RunsTasksOnCurrentThread()); 38 DCHECK(ui_thread_->RunsTasksOnCurrentThread());
39 } 39 }
40 40
41 // Called on FILE thread. 41 // Called on FILE thread.
42 virtual ~FileWorker() { DCHECK(file_thread_->RunsTasksOnCurrentThread()); } 42 virtual ~FileWorker() { DCHECK(file_thread_->RunsTasksOnCurrentThread()); }
43 43
44 void Start() { 44 void Start() {
45 DCHECK(file_thread_->RunsTasksOnCurrentThread()); 45 DCHECK(file_thread_->RunsTasksOnCurrentThread());
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Control and state paths for the cgroup whose processes will be frozen. 125 // Control and state paths for the cgroup whose processes will be frozen.
126 base::FilePath to_be_frozen_control_path_; 126 base::FilePath to_be_frozen_control_path_;
127 base::FilePath to_be_frozen_state_path_; 127 base::FilePath to_be_frozen_state_path_;
128 128
129 bool enabled_; 129 bool enabled_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(FileWorker); 131 DISALLOW_COPY_AND_ASSIGN(FileWorker);
132 }; 132 };
133 133
134 FreezerCgroupProcessManager::FreezerCgroupProcessManager() 134 FreezerCgroupProcessManager::FreezerCgroupProcessManager()
135 : file_thread_(content::BrowserThread::GetMessageLoopProxyForThread( 135 : file_thread_(content::BrowserThread::GetTaskRunnerForThread(
136 content::BrowserThread::FILE)), 136 content::BrowserThread::FILE)),
137 file_worker_(new FileWorker(file_thread_)) { 137 file_worker_(new FileWorker(file_thread_)) {
138 file_thread_->PostTask(FROM_HERE, 138 file_thread_->PostTask(FROM_HERE,
139 base::Bind(&FileWorker::Start, 139 base::Bind(&FileWorker::Start,
140 base::Unretained(file_worker_.get()))); 140 base::Unretained(file_worker_.get())));
141 } 141 }
142 142
143 FreezerCgroupProcessManager::~FreezerCgroupProcessManager() { 143 FreezerCgroupProcessManager::~FreezerCgroupProcessManager() {
144 file_thread_->DeleteSoon(FROM_HERE, file_worker_.release()); 144 file_thread_->DeleteSoon(FROM_HERE, file_worker_.release());
145 } 145 }
(...skipping 22 matching lines...) Expand all
168 168
169 void FreezerCgroupProcessManager::CheckCanFreezeRenderers( 169 void FreezerCgroupProcessManager::CheckCanFreezeRenderers(
170 ResultCallback callback) { 170 ResultCallback callback) {
171 file_thread_->PostTask(FROM_HERE, 171 file_thread_->PostTask(FROM_HERE,
172 base::Bind(&FileWorker::CheckCanFreezeRenderers, 172 base::Bind(&FileWorker::CheckCanFreezeRenderers,
173 base::Unretained(file_worker_.get()), 173 base::Unretained(file_worker_.get()),
174 callback)); 174 callback));
175 } 175 }
176 176
177 } // namespace chromeos 177 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698