| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |