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

Side by Side Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 1193303002: base/threading: restrict to set only current thread priority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, review #29 Created 5 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 (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/renderer/gpu/compositor_output_surface.h" 5 #include "content/renderer/gpu/compositor_output_surface.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ReclaimResources(&ack); 200 ReclaimResources(&ack);
201 } 201 }
202 202
203 bool CompositorOutputSurface::Send(IPC::Message* message) { 203 bool CompositorOutputSurface::Send(IPC::Message* message) {
204 return message_sender_->Send(message); 204 return message_sender_->Send(message);
205 } 205 }
206 206
207 #if defined(OS_ANDROID) 207 #if defined(OS_ANDROID)
208 namespace { 208 namespace {
209 void SetThreadPriorityToIdle() { 209 void SetThreadPriorityToIdle() {
210 base::PlatformThread::SetThreadPriority(base::PlatformThread::CurrentHandle(), 210 base::PlatformThread::SetCurrentThreadPriority(
211 base::ThreadPriority::BACKGROUND); 211 base::ThreadPriority::BACKGROUND);
212 } 212 }
213 void SetThreadPriorityToDefault() { 213 void SetThreadPriorityToDefault() {
214 base::PlatformThread::SetThreadPriority(base::PlatformThread::CurrentHandle(), 214 base::PlatformThread::SetCurrentThreadPriority(base::ThreadPriority::NORMAL);
215 base::ThreadPriority::NORMAL);
216 } 215 }
217 } // namespace 216 } // namespace
218 #endif 217 #endif
219 218
220 void CompositorOutputSurface::UpdateSmoothnessTakesPriority( 219 void CompositorOutputSurface::UpdateSmoothnessTakesPriority(
221 bool prefers_smoothness) { 220 bool prefers_smoothness) {
222 #if defined(OS_ANDROID) 221 #if defined(OS_ANDROID)
223 if (prefers_smoothness_ == prefers_smoothness) 222 if (prefers_smoothness_ == prefers_smoothness)
224 return; 223 return;
225 prefers_smoothness_ = prefers_smoothness; 224 prefers_smoothness_ = prefers_smoothness;
226 if (prefers_smoothness) { 225 if (prefers_smoothness) {
227 main_thread_runner_->PostTask(FROM_HERE, 226 main_thread_runner_->PostTask(FROM_HERE,
228 base::Bind(&SetThreadPriorityToIdle)); 227 base::Bind(&SetThreadPriorityToIdle));
229 } else { 228 } else {
230 main_thread_runner_->PostTask(FROM_HERE, 229 main_thread_runner_->PostTask(FROM_HERE,
231 base::Bind(&SetThreadPriorityToDefault)); 230 base::Bind(&SetThreadPriorityToDefault));
232 } 231 }
233 #endif 232 #endif
234 } 233 }
235 234
236 } // namespace content 235 } // namespace content
OLDNEW
« base/threading/platform_thread_unittest.cc ('K') | « content/gpu/gpu_child_thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698