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

Side by Side Diff: cc/raster_worker_pool.cc

Issue 11880014: cc: Set ui/gpu/cc/ipc/upload/raster thread priorities. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address feedback (use static). Created 7 years, 11 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 | « cc/raster_worker_pool.h ('k') | content/browser/browser_main_loop.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/raster_worker_pool.h" 5 #include "cc/raster_worker_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "cc/picture_pile_impl.h" 13 #include "cc/picture_pile_impl.h"
14 #include "third_party/skia/include/core/SkDevice.h" 14 #include "third_party/skia/include/core/SkDevice.h"
15 15
16 #if defined(OS_ANDROID)
17 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
18 #include <sys/resource.h>
19 #endif
20
16 namespace cc { 21 namespace cc {
17 22
18 namespace { 23 namespace {
19 24
20 void RunRasterTask(PicturePileImpl* picture_pile, 25 void RunRasterTask(PicturePileImpl* picture_pile,
21 uint8* buffer, 26 uint8* buffer,
22 const gfx::Rect& rect, 27 const gfx::Rect& rect,
23 float contents_scale, 28 float contents_scale,
24 RenderingStats* stats) { 29 RenderingStats* stats) {
25 TRACE_EVENT0("cc", "RunRasterTask"); 30 TRACE_EVENT0("cc", "RunRasterTask");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 RasterWorkerPool::Thread::Thread(const std::string name) 75 RasterWorkerPool::Thread::Thread(const std::string name)
71 : base::Thread(name.c_str()), 76 : base::Thread(name.c_str()),
72 num_pending_tasks_(0) { 77 num_pending_tasks_(0) {
73 Start(); 78 Start();
74 } 79 }
75 80
76 RasterWorkerPool::Thread::~Thread() { 81 RasterWorkerPool::Thread::~Thread() {
77 Stop(); 82 Stop();
78 } 83 }
79 84
85 void RasterWorkerPool::Thread::Init() {
86 #if defined(OS_ANDROID)
87 // TODO(epenner): Move thread priorities to base. (crbug.com/170549)
88 int nice_value = 10; // Idle priority.
89 setpriority(PRIO_PROCESS, base::PlatformThread::CurrentId(), nice_value);
90 #endif
91 }
92
80 RasterWorkerPool::RasterWorkerPool(size_t num_raster_threads) { 93 RasterWorkerPool::RasterWorkerPool(size_t num_raster_threads) {
81 const std::string thread_name_prefix = kRasterThreadNamePrefix; 94 const std::string thread_name_prefix = kRasterThreadNamePrefix;
82 while (raster_threads_.size() < num_raster_threads) { 95 while (raster_threads_.size() < num_raster_threads) {
83 int thread_number = raster_threads_.size() + 1; 96 int thread_number = raster_threads_.size() + 1;
84 raster_threads_.push_back( 97 raster_threads_.push_back(
85 new Thread(thread_name_prefix + 98 new Thread(thread_name_prefix +
86 StringPrintf("Worker%d", thread_number).c_str())); 99 StringPrintf("Worker%d", thread_number).c_str()));
87 } 100 }
88 } 101 }
89 102
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 190 }
178 191
179 void RasterWorkerPool::OnRasterTaskCompleted( 192 void RasterWorkerPool::OnRasterTaskCompleted(
180 Thread::Task* task, 193 Thread::Task* task,
181 scoped_refptr<PicturePileImpl> picture_pile, 194 scoped_refptr<PicturePileImpl> picture_pile,
182 const base::Closure& reply) { 195 const base::Closure& reply) {
183 OnTaskCompleted(task, reply); 196 OnTaskCompleted(task, reply);
184 } 197 }
185 198
186 } // namespace cc 199 } // namespace cc
OLDNEW
« no previous file with comments | « cc/raster_worker_pool.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698